It's not an bug... Sa-mp is single thread so it can only do one thing at the time... So if mysql_query takes 20ms to execute it will stop the server for 20ms. The time it takes for mysql_query to execute depends on the mysql servers load and the ping to the mysql server. But yes using mysql_query_callback would fix that problem.
|
[13:36:35] CMySQLHandler::~CMySQLHandler() - deconstructor called. [13:36:35] CMySQLHandler::FreeResult() - The result is already empty. [13:36:35] CMySQLHandler:isconnect() - Connection was closed. [13:36:38] [13:36:38] --------------------------- [13:36:38] MySQL Debugging activated (11/14/11) [13:36:38] --------------------------- [13:36:38] [13:36:38] >> mysql_connect( ) [13:36:38] CMySQLHandler::CMySQLHandler() - constructor called. [13:36:38] CMySQLHandler::CMySQLHandler() - Connecting to "127.0.0.1" | DB: "Joomla15" | Username: "root" ... [13:36:38] CMySQLHandler::Connect() - Connection was successful. [13:36:38] CMySQLHandler::Connect() - Auto-Reconnect has been enabled. |
SELECT `id`, `column1`, `column2` FROM `table` WHERE `column3`=0
mysql_query("SELECT `id`, `column1`, `column2` FROM `table` WHERE `column3`=0");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_get_field("column1",tmp);
if(strval(tmp) > 0)
{
mysql_get_field("id",tmp);
// some stuff
mysql_get_field("column2",tmp);
}
}
mysql_free_result();
[10:28:54] --------------------------- [10:28:54] MySQL Debugging activated (11/20/11) [10:28:54] --------------------------- [10:28:54] [10:28:54] >> mysql_set_charset( Connection handle: 1 ) [10:28:54] >> mysql_query( Connection handle: 1 ) [10:28:54] CMySQLHandler::Query(SET NAMES 'cp1251') - Successfully executed. [10:28:54] >> mysql_query( Connection handle: 1 ) [10:28:54] CMySQLHandler::Query(UPDATE `table2` SET `somecolumn` = 0) - Successfully executed. [10:28:54] >> mysql_query( Connection handle: 1 ) [10:28:54] CMySQLHandler::Query(SELECT `id`, `column1`, `column2` FROM `table` WHERE `column3`=0) - Successfully executed. [10:28:54] >> mysql_store_result( Connection handle: 1 ) [10:28:54] CMySQLHandler::StoreResult() - Result was stored. [10:28:54] >> mysql_retrieve_row( Connection handle: 1 ) [10:28:54] >> mysql_fetch_field_row( Connection handle: 1 ) [10:28:54] CMySQLHandler::FetchField("column1") - 1309637542 [10:28:54] >> mysql_fetch_field_row( Connection handle: 1 )
if(strlen(params) == 0 || strlen(params) > 24) return IRC_GroupSay(gGroupID,IRC_ADMIN, "4 Enter a valid User.."); new escname[200], msg[256], query[256]; mysql_real_escape_string(params, escname); format(query, sizeof(query), "SELECT * FROM `bans` WHERE `name` = '%s' LIMIT 1 ", escname); mysql_query(query); mysql_store_result(); if (mysql_num_rows() == 0) return IRC_GroupSay(gGroupID,IRC_ADMIN,"1 Sorry, This user is not found in bans list."); new banner[64], reason[256], bandate[64], index, line[50], buffer[149], banl[64], result[200]; if (mysql_retrieve_row()) { mysql_fetch_field_row(banner,"banner"); mysql_fetch_field_row(reason,"reason"); mysql_fetch_field_row(banl,"banlength"); mysql_fetch_field_row(bandate,"bandate"); } //// REST NOT SHOWN (DOESN'T CAUSE CRASH)
[2011/11/28 16:31:04] --- Crashdetect v3.6.6 loaded [2011/11/28 16:31:04] Loaded debug info from 'filterscripts\*******.amx' [2011/11/28 16:31:04] Loaded debug info from 'gamemodes\nmss.amx' [2011/11/28 16:42:05] Server crash caused by native mysql_ping() called at line 36304 in 'C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SERVER\gamemodes\nmss.pwn' [2011/11/28 16:42:05] Call stack (most recent call first): [2011/11/28 16:42:05] File 'C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SERVER\gamemodes\nmss.pwn', line 36289 [2011/11/28 16:42:05] CallFlag()
This crashes the server. I used another plugin by blue g and it worked fine. i got vps and im using the r-6 debian 5 plugin
code is here Код:
if(strlen(params) == 0 || strlen(params) > 24) return IRC_GroupSay(gGroupID,IRC_ADMIN, "4 Enter a valid User.."); new escname[200], msg[256], query[256]; mysql_real_escape_string(params, escname); format(query, sizeof(query), "SELECT * FROM `bans` WHERE `name` = '%s' LIMIT 1 ", escname); mysql_query(query); mysql_store_result(); if (mysql_num_rows() == 0) return IRC_GroupSay(gGroupID,IRC_ADMIN,"1 Sorry, This user is not found in bans list."); new banner[64], reason[256], bandate[64], index, line[50], buffer[149], banl[64], result[200]; if (mysql_retrieve_row()) { mysql_fetch_field_row(banner,"banner"); mysql_fetch_field_row(reason,"reason"); mysql_fetch_field_row(banl,"banlength"); mysql_fetch_field_row(bandate,"bandate"); } //// REST NOT SHOWN (DOESN'T CAUSE CRASH) |
Hey Guy's,
i didn't want to read through all the sites here so i don't know if someone had this problem before but when i try to compile my GM the compiler crashes without any error. Do you know why? Prio |
i get the following error when i try to compile the plugin (OS: Debian 6, MySQL Version: 5.1.49-3):
samp@Debian-60-squeeze-64-minimal:~/gsql/mysql_rel$ make gcc -c -O3 -w -DLINUX -Wall -I../SDK/amx/ ../SDK/amx/*.c g++ -c -O3 -w -DLINUX -Wall -I../SDK/amx/ ../SDK/*.cpp g++ -c -O3 -w -DLINUX -Wall -I../SDK/amx/ main.cpp g++ -c -O3 -w -DLINUX -Wall -I../SDK/amx/ source/*.cpp g++ -O2 -fshort-wchar -shared -o "../mysql.so" *.o -L/usr/lib/mysql -lmysqlclient_r -lpthread /usr/bin/ld: CAmxString.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC CAmxString.o: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [all] Error 1 |