Which MySQL safe method is bether? - 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: Which MySQL safe method is bether? (
/showthread.php?tid=354369)
Which MySQL safe method is bether? -
tMike - 26.06.2012
Hy!
I tried a lot of different save types, like one query for all data (example:
Код:
format(query,sizeof(query),"UPDATE players SET Password = '%s',Level = '%d',Age = '%d' (and a lot of more...) WHERE Name = '%s' LIMIT 1", PlayerValue[playerid][pKey], PlayerValue[playerid][pPlayerLevel],PlayerValue[playerid][pAge], name);
mysql_query(query);
)
or more querys for one data like this:
Код:
format(query,sizeof(query),"UPDATE players SET Password = '%s' WHERE Name = '%s' LIMIT 1", PlayerValue[playerid][pKey], name);
mysql_query(query);
format(query,sizeof(query),"UPDATE players SET PlayerLevel = '%d' WHERE Name = '%s' LIMIT 1", PlayerValue[playerid][pPlayerLevel], name);
mysql_query(query);
format(query,sizeof(query),"UPDATE players SET Age= '%d' WHERE Name = '%s' LIMIT 1", PlayerValue[playerid][pAge], name);
mysql_query(query);
Totally, i have over 135 player-values to save in the MySQL-database. The problem is, that the server returns a UNKNOWN Command when i'm using the save command for each player (in a foreach-loop the public for saving data is executed). Now i want to know what is the fastest, most resource-efficient method for saving data? Remember, i have to push the size of the query string when i'm putting all in one string.
Im lookin' forward to your help!
Re: Which MySQL safe method is bether? -
Smokkr - 26.06.2012
pawn Код:
format(query,sizeof(query),"UPDATE players SET Password = '%s',Level = '%d',Age = '%d' (and a lot of more...) WHERE Name = '%s' LIMIT 1", PlayerValue[playerid][pKey], PlayerValue[playerid][pPlayerLevel],PlayerValue[playerid][pAge], name);
mysql_query(query);
This one
AW: Which MySQL safe method is bether? -
tMike - 26.06.2012
But make the string-size no problems with the performance or make this no matter?
Because i think the size will be over > 600 and when 40 players or more are connected it will lagg or?