SA-MP Forums Archive
MySQL R7 - 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: MySQL R7 - Cache (/showthread.php?tid=440156)



MySQL R7 - Cache - Abreezy - 28.05.2013

Hello,

I've been recommended to update from r5 to r7, so I began learning these cache functions, but I'm confused. How would I go about using a loop with cache? For example, converting this:

pawn Код:
mysql_query("SELECT * FROM saes_stopsigns");
    mysql_store_result();
    new stopid;
    while(mysql_fetch_row_format(myquery, "|"))
    {
        sscanf(myquery, "p<|>e<iffff>", StopSign[stopid]);
       
        printf("Stop Signs %i ::: %f %f %f", stopid, StopSign[stopid][sPosX], StopSign[stopid][sPosY], StopSign[stopid][sPosZ]);
        stopid++;
    }
To using cache functions. So Far I got this, but I'm not sure:

pawn Код:
new stopids;
    format(query, sizeof(query), "SELECT * FROM saes_stopsigns");
    mysql_function_query(1, query, true, "OnStopSignLoad", "i", stopids);
forward OnStopSignLoad(stopid);
public OnStopSignLoad(stopid)
{
    new rows, fields;
    cache_get_data(rows, fields);

    return 1;
}
Not much, but this is why I ask on here, how would I go about doing this? Thanks in advance to any assistance.