mysql threads
#1

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 )
Reply
#2

mysql_free_result();

If I were you, I'd add it within the script, instead of using the callback for that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)