SA-MP Forums Archive
MySQL R41-2 cache 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: MySQL R41-2 cache question (/showthread.php?tid=633860)



MySQL R41-2 cache question - Riwerry - 08.05.2017

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:
pawn Код:
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);
        }
}



Re: MySQL R41-2 cache question - Vince - 08.05.2017

No, you don't. This happens automatically.