10.06.2014, 12:35
(
Последний раз редактировалось DrakeX; 10.06.2014 в 22:48.
)
I noticed some lag which occurred in a command, and traced it to the saving proportion of my script. The issue is 34 queries (run at the same time with other queries used to save player data and information; amount also dependent on how many vehicles a player has that I'm saving information for).
The proportion of code shown above was previously something similar (but not exact) to:
However I decided to use a loop instead as it would be shorter. When retrieving information, these loops (and db_get_field_assoc()) do not cause an issue. Again, the lag is minor, but is there something I should be doing better to prevent db_query from causing this issue (aside from what I initially had)? Thanks.
pawn Код:
new string[128];
for(new l = 0; l < 17; l ++)
{
format(string, sizeof(string), "UPDATE `VEHICLES` SET `MOD%d` = '%d' WHERE `ID` = '%d'", l, PlayerVehicleInformation[playerid][i][Mod][l], <ID>);
db_query(database, string);
}
pawn Код:
new string[512];
format(string, sizeof(string), "UPDATE `VEHICLES` SET `MOD1`, `MOD2, `MOD3`, `MOD4` WHERE `ID` = '%d", mod[0], mod[1], mod[2], mod[3], etc);