mysql threads - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql threads (
/showthread.php?tid=296042)
mysql threads -
ajwar - 09.11.2011
pawn Код:
new pOcars[75];
format(pOcars,75,"SELECT vID FROM `privateveh` WHERE vOwner = '%s'",pName(playerid),THREAD_KI1,playerid);
mysql_query(pOcars);
new pOBussines[75];
format(pOBussines,75,"SELECT id FROM `business` WHERE owner = '%s'",pName(playerid),THREAD_KI2,playerid);
mysql_query(pOBussines);
new pOHouses[75];
format(pOHouses,75,"SELECT id FROM `houses` WHERE owner = '%s'",pName(playerid),THREAD_KI3,playerid);
mysql_query(pOHouses);
pawn Код:
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
switch(resultid)
{
case THREAD_KI1:
{
mysql_store_result();
PVar[extraid][pOwnedCars] = mysql_num_rows();
mysql_free_result();
}
case THREAD_KI2:
{
mysql_store_result();
PVar[extraid][pOwnedBusiness] = mysql_num_rows();
mysql_free_result();
}
case THREAD_KI3:
{
mysql_store_result();
PVar[extraid][pOwnedHouse] = mysql_num_rows();
mysql_free_result();
}
}
return 1;
}
output
pawn Код:
[15:38:46] CMySQLHandler::Query(SELECT vID FROM `privateveh` WHERE vOwner = 'Lorek_Bamb') - Successfully executed.
[15:38:46] >> mysql_query( Connection handle: 1 )
[15:38:46] CMySQLHandler::Query(SELECT id FROM `business` WHERE owner = 'Lorek_Bamb') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
[15:38:46] >> mysql_query( Connection handle: 1 )
[15:38:46] CMySQLHandler::Query(SELECT id FROM `houses` WHERE owner = 'Lorek_Bamb') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
[15:38:46] >> mysql_ping( Connection handle: 1 )
Re : mysql threads -
decondelite - 09.11.2011
mysql_free_result();
If I were you, I'd add it within the script, instead of using the callback for that.