mysql_tquery/mysql_pquery
#1

When should I use either of them?
Reply
#2

As far I understand, when you use tquery your query gets added to an internal queue and it is executed in one thread separate from that of the SA-MP server. With pquery the query gets sent immediately and in an entirely separate thread without regards for any other previous queries in line.

This makes pquery potentially dangerous if the query you're sending depends on the result of an earlier query (race condition). E.g. creating a group and then putting the player in that group. Assuming a proper relational model, if your "put player in group" query arrives before your "create group" query you will get a foreign key error because the database won't allow you to put a player in a group that does not exist.

I would only ever use pquery for insert or update statements that have no callback attached to them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)