30.01.2010, 13:00
I really love the whole queue idea. Great job, G-Stylezz. Again.
Besides that:
You do such a little, confusing thing in here:
Returning 0 I mean. In my plugin-cross-compatible code I just use (and used, even with the old version of your plugin) if(mysql_query()) to check whether I should process the query futher. You disallow the code to work by returning 0 whatever the result is - it's also incomatible with the older version. I also can't define a macro to check whether its equal to 0, as mysql_query() is not only used with if() (like in threaded queries), so the code would be quite crappy.
I think you could simply return 0/1 with non-threaded queries, and -1 in threaded ones. The code would be backward compatible then.
It is made on purpose, or it's rather an omission, like:
?
Regards!
EDIT:
Another catch.
You register the native which is never used.
Besides that:
Код:
[14:22:20] CMySQLHandler::Connect() - Connection was successful. [14:22:20] >> mysql_query( Connection handle: 1 ) [14:22:20] CMySQLHandler::Query(select * from hrp_door) - Successfully executed. [14:22:20] >> mysql_query( Connection handle: 1 ) [14:22:20] CMySQLHandler::Query(select * from hrp_gz) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now) [14:22:20] >> mysql_query( Connection handle: 1 ) [14:22:20] CMySQLHandler::Query(select * from hrp_anim) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now) [14:22:20] >> mysql_query( Connection handle: 1 )
Код:
cell AMX_NATIVE_CALL NativeFunctions::n_mysql_query( AMX* amx, cell* params ) { unsigned int cID = params[3]-1; MySQL_Log(">> mysql_query( Connection handle: %d )",cID+1); VALID_CONNECTION_HANDLE("mysql_query",cID); CMySQLHandler *cHandle = SQLHandle[cID]; cHandle->Query(AMX_H->GetString(amx,params[1]),params[2]); return 0; }
I think you could simply return 0/1 with non-threaded queries, and -1 in threaded ones. The code would be backward compatible then.
It is made on purpose, or it's rather an omission, like:
Quote:
my_ulonglong CMySQLHandler::InsertId() { if(!m_bIsConnected) { NativeFunctions::MySQL_Log("CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)."); |
Regards!
EDIT:
Another catch.
Код:
cell AMX_NATIVE_CALL NativeFunctions::n_mysql_fetch_field( AMX* amx, cell* params ) { /*MySQL.field = (MYm_stField *)malloc(100); MySQL.field = mysql_fetch_field_direct(MySQL.res, params[1]); AmxStringHandler->SetString(amx,params[2],std::string(MySQL.field->name)); MySQL_Log("mysql_fetch_field(Number: %d); Return: \"%s\"",params[1],MySQL.field->name); free(MySQL.field);*/ return 1; }