25.01.2010, 21:52
What query would I send? SELECT *?
[05:58:35] MySQL connection has been established [05:58:35] mysql_stat(); Return "Uptime: 2056361 Threads: 1 Questions: 2289948 Slow queries: 0 Opens: 68895 Flush tables: 1 Open tables: 64 Queries per second avg: 1.114" [05:59:12] mysql_ping(); Return: 1 [05:59:12] mysql_query("SELECT * FROM `wcf1_user` WHERE username = 'Dwayne_Johnson'",Resultid: 1); [05:59:12] New thread created (Thread ID: -156173424 | Result ID: 1 | Threadsafe: No) |
Originally Posted by Mikep.
What query would I send? SELECT *?
|
27/01/2010 (Updates & information): - Plugin was rewritten from scratch (dynamic classes) - It's the most stable version ever - the plugin tries to avoid crashes by ignoring invalid queries/requests - Threading code works fine now! (Invalid queries will be skipped and not called in OnQueryFinish()) - The new parameter in all functions (except for mysql_connect()) allows you to connect to different databases. It has a default value, so you're not forced to use it - You'll have to compile your script with the latest includes to get the plugin working - Some new functions that might be useful - Don't use mysql_connect() if the connection timed out .. simply use mysql_reconnect() (Host information is now saved until a restart)! - I highly suggest to thread all queries (even UPDATE & INSERT queries)
Originally Posted by $ЂЯĢ
Quote:
|
format(query2, 256, "SELECT INET_NTOA(ip) FROM table2 WHERE ip = '%s'", result);
format(string,sizeof(string),"SELECT * FROM `"TABLENAME"` WHERE username = '%s' AND password = sha(concat(salt,sha(concat(salt,sha('%s'))))) LIMIT 11",pname,pass); mysql_query(string);
[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; }
my_ulonglong CMySQLHandler::InsertId() { if(!m_bIsConnected) { NativeFunctions::MySQL_Log("CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)."); |
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; }
Originally Posted by Wicko
I really love the whole queue idea. Great job, G-Stylezz. Again.
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 ) |
Originally Posted by mysql.com
If you get Commands out of sync; you can't run this command now in your client code, you are calling client functions in the wrong order.
This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without calling mysql_use_result() or mysql_store_result() in between. |
Originally Posted by Wicko
You do such a little, confusing thing in here:
Код:
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. |
Originally Posted by Wicko
It is made on purpose, or it's rather an omission, like:
Quote:
Regards! |
Originally Posted by Wicko
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; } |