Public Member Functions | Public Attributes

mysqlpl::MSqlException Class Reference

MySQL Errorhandling. More...

Inheritance diagram for mysqlpl::MSqlException:
Inheritance graph
[legend]
Collaboration diagram for mysqlpl::MSqlException:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 this (MYSQL *db)
 version (MYSQLPL_PREP_STMT)
 this (in char[] msg)
 version (MYSQLPL_PREP_STMT)

Public Attributes

uint _sql_error_code
char[] _last_sql

Detailed Description

MySQL Errorhandling.

Definition at line 275 of file mysqlpl.d.


Constructor & Destructor Documentation

mysqlpl::MSqlException::this ( MYSQL *  db ) [inline]

Definition at line 277 of file mysqlpl.d.

References mysqlpl::version().

    {
        _sql_error_code = mysqlpl_errno(db);
        char* error_str = mysqlpl_error(db);

      version(MYSQLPL_PREP_STMT) {
        char* state_str = mysqlpl_sqlstate(db);

        super(format("MySQL error %d - SQLSTATE %s: %s",
                _sql_error_code, state_str[0..strlen(state_str)], error_str[0..strlen(error_str)]));

        _sqlstate = state_str[0 .. state_str?strlen(state_str):0];
      } else {
        super(format("MySQL error %d: %s", _sql_error_code, error_str));
      }

    //  _file = file;
    //  _line = line;
    }

Here is the call graph for this function:

mysqlpl::MSqlException::this ( in char[]  msg ) [inline]

Definition at line 342 of file mysqlpl.d.

    {
        super(msg);

    //  _file = file;
    //  _line = line;
    }

Member Function Documentation

mysqlpl::MSqlException::version ( MYSQLPL_PREP_STMT   ) [inline]

Definition at line 297 of file mysqlpl.d.

References mysqlpl::version().

                             {
    this(MYSQL_STMT* s/*, in char[] file, int line*/)
    {
        _sql_error_code = mysqlpl_stmt_errno(s);
        char* error_str = mysqlpl_stmt_error(s);

      version(MYSQLPL_PREP_STMT) {
        char* state_str = mysqlpl_stmt_sqlstate(s);

        super(format("MySQL error %d - SQLSTATE %s: %s",
                _sql_error_code, state_str[0..strlen(state_str)], error_str[0..strlen(error_str)]));

        _sqlstate = state_str[0 .. state_str?strlen(state_str):0];
      } else {
        super(format("MySQL error %d: %s", _sql_error_code, error_str));
      }

    //  _file = file;
    //  _line = line;
    }

    this(MYSQL_STMT* s, SqlStatement stmt/*, in char[] file, int line*/)
    {
        _sql_error_code = mysqlpl_stmt_errno(s);
        char* error_str = mysqlpl_stmt_error(s);
        char* state_str = mysqlpl_stmt_sqlstate(s);

        char[] msg = format("MySQL error %d - SQLSTATE %s: %s",
                        _sql_error_code, state_str[0..strlen(state_str)], error_str[0..strlen(error_str)]);

        _last_sql = stmt.get_last_sql();

        if (_last_sql.length)
            msg ~= format("\nlast SQL statement:\n%s\n", _last_sql);

        super(msg);

        _sqlstate = state_str[0 .. state_str?strlen(state_str):0];

    //  _file = file;
    //  _line = line;
    }

  } // MYSQLPL_PREP_STMT

Here is the call graph for this function:

mysqlpl::MSqlException::version ( MYSQLPL_PREP_STMT   ) [inline]

Definition at line 352 of file mysqlpl.d.

                             {
    char[]  _sqlstate;
  }

Member Data Documentation

Definition at line 356 of file mysqlpl.d.

Definition at line 350 of file mysqlpl.d.


The documentation for this class was generated from the following file: