Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

MySQL R41-2 cache question

$
0
0
Hey, I'm wondering if is needed to save and afterwards delete active cache even when I'm not gonna use it later. In the callback I just assign values to global variables.

Basicly, I have it like that right now:
Code:

mysql_format(g_sMySQL, query, sizeof(query), "SELECT * FROM `player_main` WHERE `name` = '%e'", input);
mysql_tquery(g_sMySQL, query, "OnMDCQuery", "ii", playerid, 0);

forward OnMDCQuery(playerid, type);
public OnMDCQuery(playerid, type)
{
        new
                Cache:result = cache_save()
        ;
       
        switch(type)
        {
                case 0:
                {//First query which is fired after inputting text
                        if(cache_num_rows() > 0)
                        {
                                cache_get_value_int(0, "id", g_sDatabaseID[playerid]);
                                cache_get_value(0, "name", g_sName[playerid], MAX_PLAYER_NAME);
                        }
                }
        }
       
        if(cache_is_valid(result)
        {
                cache_delete(result);
        }
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>