Explanation | Question
#1

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

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.
Reply
#3

So when should I use it? Is there a problem if I don't use it?
Reply
#4

First of all, this seems to be somewhat outdated. I'd recommend using mysql_tquery, as non-threaded queries can hang the server.
Reply
#5

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 ?
Reply
#6

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.
Reply
#7

Yep, that's what I do. Thank you all for your answers!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)