1 or 2? - 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: 1 or 2? (
/showthread.php?tid=615605)
1 or 2? -
Spenker - 24.08.2016
How is the best option?
Option 1:
Код HTML:
public OnPlayerConnect(playerid)
{
mysql_format(MySQLCon, stmsg[playerid], 150, "SELECT * FROM `bans` WHERE `Player` = '%e' OR `IP` = '%s'", GetNameP(playerid), IPPlayer(playerid)),
mysql_pquery(MySQLCon, stmsg[playerid], "OnBanCheck", "d", playerid);
return 1;
}
Option 2:
Код HTML:
public OnPlayerConnect(playerid)
{
mysql_format(MySQLCon, stmsg[playerid], 150, "SELECT * FROM `bans` WHERE `Player` = '%e' OR `IP` = '%s'", GetNameP(playerid), IPPlayer(playerid)),
mysql_tquery(MySQLCon, stmsg[playerid], "OnBanCheck", "d", playerid);
return 1;
}
Re: 1 or 2? -
Stinged - 24.08.2016
http://forum.sa-mp.com/showpost.php?...postcount=5021
Explains it very well.
EDIT: By the way, next time please be more clear about your question.
It took me a minute to find the difference between the two.
Re: 1 or 2? -
theonethatownz - 24.08.2016
Removed
Re: 1 or 2? -
Spenker - 24.08.2016
Thank you.
In this case it would be much better to use only pquery for all queries in my Gamemode?
Re: 1 or 2? -
Stinged - 24.08.2016
Quote:
Originally Posted by Spenker
Thank you.
In this case it would be much better to use only pquery for all queries in my Gamemode?
|
It depends on what you're doing.
I've been using tqueries since forever and I've never had any problems.
If you want a query to run even if there are other queries running, use pqueries.
If you don't mind them running one after the other, use tqueries.
EDIT: fixed 'the' to 'them'
Re: 1 or 2? -
Spenker - 24.08.2016
Ok, thank you.
Re: 1 or 2? -
Konstantinos - 24.08.2016
It is worth noting that if you want some queries to be executed in order (like sending a DELETE query and then directly an INSERT query), you shouldn't use mysql_pquery because it's not guarantee that will be executed with the same order they were sent.
Re: 1 or 2? -
Spenker - 24.08.2016
Quote:
Originally Posted by Konstantinos
It is worth noting that if you want some queries to be executed in order (like sending a DELETE query and then directly an INSERT query), you shouldn't use mysql_pquery because it's not guarantee that will be executed with the same order they were sent.
|
It would be more beneficial if they use pquery only "SELECT * FROM ..." ?
Re: 1 or 2? -
Konstantinos - 24.08.2016
Quote:
Originally Posted by Spenker
It would be more beneficial if they use pquery only "SELECT * FROM ..." ?
|
You won't notice much of a difference unless many queries will be sent at once (and still, the time it takes is in milliseconds (at least for a samp server)) - and by difference I'm not referring to the server (both are executed in different thread than the main one)
Re: 1 or 2? -
Spenker - 24.08.2016
Ok, thank you.