SA-MP Forums Archive
tquery vs pquery - 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: tquery vs pquery (/showthread.php?tid=570349)



tquery vs pquery - Denis1 - 09.04.2015

May I ask what is the difference between these two native MySQL plugin functions: mysql_tquery and mysql_pquery.


Re: tquery vs pquery - Boyka96 - 09.04.2015

thats a good question .. the difference is the speed .. mysql_pquery is faster, however it depends on how many connections you have (how many databases are connected at the same time) .. anyway both of them have the same effects: execute a query and triggers a callback may also send some values to the callback (playerid or whatever).
P.S: I'm not sure if thats the only difference but atleast I'm sure of that.


Re: tquery vs pquery - Denis1 - 09.04.2015

Thanks for the answer, Boyka96. However, is there anyone with a better answer?


Re: tquery vs pquery - Sithis - 09.04.2015

Pquery:
Sends a query which will be executed in another thread concurrently and calls the callback (if there is one) when the execution is finished.

Tquery:
Sends a query which will be executed in another thread and calls the callback (if there is one) when the execution is finished

Difference:
The difference between mysql_pquery() and mysql_tquery() is, that this pquery uses multi-threading, thus it's faster depending on how many connections are used. The number of connections can be specified in mysql_connect() through the pool_size parameter. Each connection resembles a thread.