#include <mysqlpl.h>
Public Types | |
typedef std::exception | super |
Public Member Functions | |
MSqlException (MYSQL *db, const char *file, int line) | |
MSqlException (const char *msg, const char *file, int line) | |
~MSqlException () throw () | |
virtual const char * | what () const throw () |
Public Attributes | |
unsigned | _sql_error_code |
std::string | _msg |
std::string | _last_sql |
const char * | _file |
int | _line |
Definition at line 104 of file mysqlpl.h.
typedef std::exception MySqlPL::MSqlException::super |
MySqlPL::MSqlException::MSqlException | ( | MYSQL * | db, |
const char * | file, | ||
int | line | ||
) |
Definition at line 80 of file mysqlpl.cpp.
References _file, _line, _msg, and _sql_error_code.
{ char buffer[2048]; _sql_error_code = mysql_errno(db); const char* error_str = mysql_error(db); #if MYSQLPL_PREP_STMT const char* state_str = mysql_sqlstate(db); sprintf(buffer, "MySQL error %u - SQLSTATE %s: %s", _sql_error_code, state_str, error_str); _sqlstate = state_str; #else sprintf(buffer, "MySQL error %u: %s", _sql_error_code, error_str); #endif _msg = _strdup((const char*)buffer); _file = file; _line = line; }
MySqlPL::MSqlException::MSqlException | ( | const char * | msg, |
const char * | file, | ||
int | line | ||
) |
Definition at line 145 of file mysqlpl.cpp.
References _file, _line, _msg, and _sql_error_code.
{ _msg = _strdup(msg); _file = file; _line = line; _sql_error_code = 0; }
MySqlPL::MSqlException::~MSqlException | ( | ) | throw () [inline] |
virtual const char* MySqlPL::MSqlException::what | ( | ) | const throw () [inline, virtual] |
const char* MySqlPL::MSqlException::_file |
Definition at line 125 of file mysqlpl.h.
Referenced by MSqlException().
std::string MySqlPL::MSqlException::_last_sql |
Definition at line 126 of file mysqlpl.h.
Referenced by MSqlException().
std::string MySqlPL::MSqlException::_msg |
Definition at line 120 of file mysqlpl.h.
Referenced by MSqlException(), and what().
Definition at line 119 of file mysqlpl.h.
Referenced by MSqlException().