Index: pol-core/pol/sqlscrobj.cpp =================================================================== --- pol-core/pol/sqlscrobj.cpp (revision 625) +++ pol-core/pol/sqlscrobj.cpp (working copy) @@ -7,7 +7,7 @@ */ -#ifdef HAVE_MYSQL +//#ifdef HAVE_MYSQL #include "../clib/stl_inc.h" #include "../clib/strutil.h" @@ -156,6 +156,10 @@ _error = "Insufficient memory"; _errno = 1; } + + //by Strelok, 2012-09-07 + //reset error number due to success. Otherwise - bugs while getting query results + _errno = 0; } BSQLConnection::BSQLConnection(std::string host, std::string user, std::string password) : BObjectImp(OTSQLConnection), _errno(0) @@ -186,6 +190,10 @@ _error = mysql_error(_conn); return false; } + + //by Strelok, 2012-09-07 + //reset error number due to success. Otherwise - bugs while getting query results + _errno = 0; return true; } bool BSQLConnection::select_db(const char *db) { @@ -194,12 +202,17 @@ _error = "No active MYSQL object instance."; return false; } - else if (!mysql_select_db(_conn,db)) + //return 0 on success, 1 on failure. removed "!". by Strelok, 2012-09-07 + else if (mysql_select_db(_conn,db)) { _errno = mysql_errno(_conn); _error = mysql_error(_conn); return false; } + + //by Strelok, 2012-09-07 + //reset error number due to success. Otherwise - bugs while getting query results + _errno = 0; return true; } bool BSQLConnection::query(const char *query) { @@ -215,7 +228,9 @@ return false; } - + //by Strelok, 2012-09-07 + //reset error number due to success. Otherwise - bugs while getting query results + _errno = 0; return true; } @@ -257,4 +272,4 @@ return new BSQLConnection(); } -#endif +//#endif