MYSQL 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 Question (
/showthread.php?tid=600718)
MYSQL Question -
Dusan01 - 12.02.2016
Hi guys, i changed my Y_INI gm to mysql, because my y_ini files stared to bug, not loading, not saving etc...
so i made this for loading stats:
Код:
LoadPStat(playerid, "level", PlayerInfo[playerid][pLevel]);
and i have about 150 lines like that, to load all stats
and here is that callback:
Код:
forward LoadPStat(playerid, what[], &sta);
public LoadPStat(playerid, what[], &sta) {
new tmp[130];
cache_get_field_content(0, what, tmp);
sta = strval(tmp);
return 1;
}
and here is query to call a load...
Код:
mysql_format(MySQL, Query, sizeof(Query), "SELECT * FROM `korisnici` WHERE `ime` = '%s'", GetName(playerid));
mysql_function_query(MySQL, Query, true, "UcitajIgraca", "i", playerid);
and this is just too slow, is there another way to speed it up or its just the host mysql too slow?
Re: MYSQL Question -
Dusan01 - 12.02.2016
Bumpy, i know it was not passed 24h but im in hurry...
Re: MYSQL Question -
sammp - 12.02.2016
Probably a host problem mate. MySQL is fast, but it requires a fast server to be fast.
Re: MYSQL Question -
Dusan01 - 12.02.2016
Quote:
Originally Posted by sammp
Probably a host problem mate. MySQL is fast, but it requires a fast server to be fast. 
|
Aham thanks bro, rep+, so my code is just fine?
Re: MYSQL Question -
Joron - 12.02.2016
Yeah...
Re: MYSQL Question -
Vince - 12.02.2016
Quote:
Originally Posted by Dusan01
and i have about 150 lines like that, to load all stats
|
*Sigh*. Sorry. This is a pet peeve of mine. Don't put so much stuff in a single table, and only load the stuff you require
at the moment. I never understood the practice of copying every single bit (no pun intended) of data into memory. Only load the stuff that is immediately visible on the screen. Stuff that is invisible until the player specifically requests it should not be loaded but instead fetched directly from the database as and when it's needed.
Re: MYSQL Question -
Dusan01 - 13.02.2016
Quote:
Originally Posted by Vince
*Sigh*. Sorry. This is a pet peeve of mine. Don't put so much stuff in a single table, and only load the stuff you require at the moment. I never understood the practice of copying every single bit (no pun intended) of data into memory. Only load the stuff that is immediately visible on the screen. Stuff that is invisible until the player specifically requests it should not be loaded but instead fetched directly from the database as and when it's needed.
|
Ahh, i know that now, but when i was creating this script from 0 i did not know that, so its 0% optimized... im trying to fix all of that now, thanks!