No active cache - 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: No active cache (
/showthread.php?tid=479702)
No active cache -
dusk - 06.12.2013
Hello.
I send a query and then loop through all the rows:
pawn Code:
for(new i; i < cache_get_row_count(); i++)
{
new name[MAX_PLAYER_NAME];
cache_get_row(i,1,name);
format(query,sizeof(query),"%s\t%d min љią savaitę\n",query,GetPlayerXpThisWeek(cache_get_row_int(i,0)));
}
But the function "GetPlayerXpThisWeek" sends a query of its' own(non threaded aswell).
pawn Code:
stock GetPlayerXpThisWeek(sqlid)
{
new query[70],int;
format(query,sizeof(query),"SELECT SecondsThisWeek FROM job_experience WHERE UserId = %d",sqlid);
new Cache:r = mysql_query(DbHandle,query);
if(cache_get_row_count()) int = cache_get_row_int(0,0);
cache_delete(r);
return int;
}
So the loop only runs once (I printed out, there are more rows).. also this warning appears
pawn Code:
[21:24:24] [WARNING] cache_get_row_count - no active cache
Re: No active cache -
Richie© - 06.12.2013
Show the query you send.
Re: No active cache -
dusk - 06.12.2013
pawn Code:
format(query,sizeof(query),"SELECT UserId,Username FROM users WHERE Job = %d",pInfo[playerid][Leader]);
new Cache:r = mysql_query(DbHandle,query);
Re: No active cache -
Richie© - 06.12.2013
Which plugin are you using?
Re: No active cache -
dusk - 06.12.2013
BlueGs R34
Re: No active cache - Patrick - 06.12.2013
Quote:
Originally Posted by dusk
pawn Code:
format(query,sizeof(query),"SELECT UserId,Username FROM users WHERE Job = %d",pInfo[playerid][Leader]); new Cache:r = mysql_query(DbHandle,query);
|
Change
pawn Code:
new Cache:r = mysql_query(DbHandle,query)
To
pawn Code:
mysql_tquery(DbHandle, query, false, "", "");
Re: No active cache -
dusk - 06.12.2013
That will just send a threaded query, which in this case is not what I want
Re: No active cache -
dusk - 06.12.2013
Actually, I did change it....(to mysql_tquery_inline to be precise) and the problem persists.
Re: No active cache -
Vince - 06.12.2013
Needs a callback! That is the whole point of threads. You CANNOT immediately retrieve a result after sending a query.
Re: No active cache -
dusk - 06.12.2013
I understand that Vince, that why I was sending unthreaded ones...