Explanation | Question - 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: Explanation | Question (
/showthread.php?tid=558720)
Explanation | Question -
Sime30 - 18.01.2015
Hi guys!
Here I am with another MySQL question...
I saw a thread by
Lynn about saving vehicles.
In his code I saw some cache result?
pawn Код:
new query[128], vehid;
mysql_format(db_connect,query,sizeof(query),"SELECT vID FROM vehicles");
new Cache:result = mysql_query(db_connect,query); // This
for(new i = 0; i < cache_get_row_count(); i++)
{
vehcount = cache_get_field_content_int(i,"vID");
}
cache_delete(result); // and this
I haven't used those by now so if someone could explain to me why and when should I use these functions?
Are they similair to mysql store result and free result?
Re: Explanation | Question -
Ironboy - 18.01.2015
Quote:
Originally Posted by Sime30
Hi guys!
Here I am with another MySQL question...
I saw a thread by Lynn about saving vehicles.
In his code I saw some cache result?
pawn Код:
new query[128], vehid; mysql_format(db_connect,query,sizeof(query),"SELECT vID FROM vehicles"); new Cache:result = mysql_query(db_connect,query); // This
for(new i = 0; i < cache_get_row_count(); i++) { vehcount = cache_get_field_content_int(i,"vID"); } cache_delete(result); // and this
I haven't used those by now so if someone could explain to me why and when should I use these functions?
Are they similair to mysql store result and free result?
|
It is using instead of mysql_free_result.
Re: Explanation | Question -
Sime30 - 18.01.2015
So when should I use it? Is there a problem if I don't use it?
Re: Explanation | Question -
Abagail - 18.01.2015
First of all, this seems to be somewhat outdated. I'd recommend using mysql_tquery, as non-threaded queries can hang the server.
Re: Explanation | Question -
Sime30 - 18.01.2015
Quote:
Originally Posted by Abagail
First of all, this seems to be somewhat outdated. I'd recommend using mysql_tquery, as non-threaded queries can hang the server.
|
As I thought. I am using tquery , callbacks, cache num rows etc... So, cache save and cache delete shouldn't bother me ?
Re: Explanation | Question -
Vince - 18.01.2015
cache_save is useful if you want to keep a large resultlset in memory for later use (acts like dynamic memory). If you thread all your queries (like you should) then you don't need cache_delete.
Re: Explanation | Question -
Sime30 - 18.01.2015
Yep, that's what I do. Thank you all for your answers!