SA-MP Forums Archive
mysql - store result. - 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 - store result. (/showthread.php?tid=434560)



mysql - store result. - audriuxxx - 03.05.2013

Hi, i have some questions.

When i load player data, i have do about 7 mysql_store_result. ofcourse i do mysql_free_result. But, if some player will spawn at the same time, can crash server, because too much store result is called?


Re: mysql - store result. - Scenario - 03.05.2013

I don't quite know why you're using mysql_store_result() 7 times. That's just utterly pointless. You should be doing a loop like while(mysql_fetch_row_format(string, "|")) and using sscanf to extract the data if you aren't using threaded queries (which I know you're not due to the functions you're using).

Switching to threaded queries makes everything 20x easier in my opinion, plus they're a bit faster since they have the caching function!


Re: mysql - store result. - audriuxxx - 03.05.2013

I use debian-6 OS. Don't care what OS is?


Re: mysql - store result. - audriuxxx - 03.05.2013

I have a lot of thins to load, and i can't it store in one line..


Re: mysql - store result. - Tanush123 - 03.05.2013

Well this is what i have in my script.
pawn Код:
SetTimer("Free",100,1);
forward Free();
public Free()
{
    mysql_store_result();
    mysql_free_result();
}
One disadvantage it does is it will spam the crap out of your mysql debug if you have it enabled. I once had bugs which crashed my server because of mysql but when i did the thing above, it stop crashing.


Re: mysql - store result. - Vince - 03.05.2013

If you need to resort to "hacks" to get things working then you're doing something seriously wrong.


Re: mysql - store result. - audriuxxx - 04.05.2013

How to possible, to load data from mysqldatabase, with one mysql_store_result, when i have about 200 things, to load? because i use a lot of loading, because i want to load a lot of things.


Re: mysql - store result. - Scenario - 04.05.2013

I think it's something like this...

pawn Код:
new
    szQuery[500];

mysql_store_result();

while(mysql_fetch_row_format(szQuery, "|"))
{
    sscanf(szQuery, "e<p<|>dds[92]dddddffffffffs[128]ddddfffff", LargeArrayVariableHere[argument1]);
   
    // data is loaded into LargeArrayVariableHere
}
Quite frankly, if you didn't know that you shouldn't be using MySQL. You're using it completely incorrectly and you're only hurting yourself and your script in the long run. Go back to files, or teach yourself something before using MySQL.