AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Thread worker was unable to start (https://forums.alliedmods.net/showthread.php?t=153626)

phela133 03-26-2011 17:39

Thread worker was unable to start
 
Code:

L 03/15/2011 - 18:37:36: [MySQL] Thread worker was unable to start. L 03/15/2011 - 18:37:36: [AMXX] Displaying debug trace (plugin "expmod.amxx") L 03/15/2011 - 18:37:36: [AMXX] Run time error 10: native error (native "SQL_ThreadQuery") L 03/15/2011 - 18:37:36: [AMXX]    [0] expmod.sma::handleSqlSaveData (line 3099)
PHP Code:

public handleSqlSaveData(FailStateHandle:QueryError[], ErrcodeData[], DataSize) {     // lots of error checking     if(Errcode)     {         log_amx("Error on Table query: %s",Error)     }     if(FailState == TQUERY_CONNECT_FAILED)     {         log_amx("Could not connect to SQL database.")         return PLUGIN_CONTINUE     }     else if(FailState == TQUERY_QUERY_FAILED)     {         log_amx("Table Query failed.")         return PLUGIN_CONTINUE     }          new id = Data[0];     if(SQL_MoreResults(Query))     {         new szCommand[512], szAuthid[32];         get_user_authid(id, szAuthid, 31);         format(szCommand, 511, "UPDATE %s SET `xp` = %i, `lvl` = %i, `pkt` = %i,`money` = %i WHERE `authid` = '%s'", gszTable, gXp[id], gLevel[id], gPoint[id], gPlayerMoney[id],szAuthid);         SQL_ThreadQuery(g_hTuple, "handleSqlSaveDataOther", szCommand);     }     else     {         new szCommand[512], szAuthid[32];         get_user_authid(id, szAuthid, 31);         format(szCommand, 511, "INSERT INTO %s (`authid`, `xp`, `lvl`, `pkt`,`money`) VALUES('%s', %i, %i, %i,%i)", gszTable, szAuthid, gXp[id], gLevel[id], gPoint[id], gPlayerMoney[id]);         SQL_ThreadQuery(g_hTuple, "handleSqlSaveDataOther", szCommand);     }          return PLUGIN_CONTINUE } 

Line 3099 is:
SQL_ThreadQuery(g_hTuple, "handleSqlSaveDataOther", szCommand);

I checked the query in the "phpmyadmin". It is correct, I have no more ideas how to fix it. Please help.

Exolent[jNr] 03-26-2011 17:41

Re: Thread worker was unable to start
 
This is not a fault of your plugin.
This is a fault of the SQLx where sometimes this occurs.
You can search for other threads regarding this issue, but AFAIK there is no official fix.

phela133 03-28-2011 03:19

Re: Thread worker was unable to start
 
In that case please write some good mysql.

Sylwester 03-28-2011 06:24

Re: Thread worker was unable to start
 
There is a simple way to get rid of that problem - save player data with only 1 query. It seems that you first check if there is data in mysql and then use update or insert. You don't need to check if data of some player was previously inserted, because you should know that from loading and even if you don't know that, then you can just use REPLACE INTO and that will work as both insert and update (you just need to set authid as PRIMARY KEY when you create table).

phela133 03-28-2011 17:31

Re: Thread worker was unable to start
 
Hmm ok, but I have a database of valuable records, which I do not want to lose.

Sylwester 03-28-2011 19:50

Re: Thread worker was unable to start
 
and what would make you lose your records?


All times are GMT -4. The time now is 14:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.