16.09.2014, 15:47
Hello,
My question is this:
Could have problems using mysql_tquery loading player data and using functions like ShowPlayerDialog?
What could happen if the player disconnect before the query is executed?
I use threaded queries because the wiki recommend it, but I think that this is worse than a little of lag.
E.g.
Now the problem will be:
1. The player connects - 0ms
2. The function mysql_tquery is called - 500ms have passed
3. The player decides disconnect immediately - 1000ms have passed
4. The function in the query is called after 1020ms, but the player isn't connected anymore, then what the hell?
I think that the worst is use threaded queries but the wiki recommends it for all the queries. Or maybe am I wrong with the problem?
Links:
https://sampwiki.blast.hk/wiki/MySQL/R33
Important
Note
It's highly recommended to thread all your queries (even INSERT & UPDATE).
My question is this:
Could have problems using mysql_tquery loading player data and using functions like ShowPlayerDialog?
What could happen if the player disconnect before the query is executed?
I use threaded queries because the wiki recommend it, but I think that this is worse than a little of lag.
E.g.
pawn Код:
mysql_format(C_ID, query, sizeof(query), \
"SELECT * FROM Users WHERE PlayerName='%s'", PlayerName[playerid]);
mysql_tquery(C_ID, query, "LoadData", "d", playerid);
pawn Код:
public LoadData(const playerid)
{
if(cache_get_row_count(C_ID) == 1)
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{FFFFFF}Login", "{61918B}This name is already {FFFFFF}registered\n{61918B}Please enter your password", "Enter", "Kick");
}
1. The player connects - 0ms
2. The function mysql_tquery is called - 500ms have passed
3. The player decides disconnect immediately - 1000ms have passed
4. The function in the query is called after 1020ms, but the player isn't connected anymore, then what the hell?
I think that the worst is use threaded queries but the wiki recommends it for all the queries. Or maybe am I wrong with the problem?
Links:
https://sampwiki.blast.hk/wiki/MySQL/R33
Important
Note
It's highly recommended to thread all your queries (even INSERT & UPDATE).