SA-MP Forums Archive
MySQL/R33 and mysql_pquery, what is works? - 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: MySQL/R33 and mysql_pquery, what is works? (/showthread.php?tid=565877)



MySQL/R33 and mysql_pquery, what is works? - PaSaSaP - 01.03.2015

Hi. For example:
Код:
functionTest()
{
 printf("1");
 mysql_pquery(MySQL_Handler, "SELECT * FROM `TableTest`");
 printf("2");
}
Second printf will be done after sending and get data from `TableTest`? Or it query is in queue and it is possible that after that line there wont be data from table?


Re: MySQL/R33 and mysql_pquery, what is works? - maramizo - 01.03.2015

Quote:

The difference between this native and mysql_tquery() is, that this type of query 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.

From the wiki.

Basically, what will happen is that it will print 1 then print 2, after that the query will be done due to delay.

If you'd like to actually print it after it is finished, this is how:

pawn Код:
functionTest()
{
    print("1");
    mysql_pquery(MySQL_Handler, "SELECT * FROM `TableTest`", "QueryFinished");
}
forward QueryFinished();
public QueryFinished()
{
    print("2");
}
P.S: There's no need to printf when you can simply print.


Re: MySQL/R33 and mysql_pquery, what is works? - PaSaSaP - 01.03.2015

Function that is runned from mysql_pquerry, as You wrote this, must be public and forward? Or can be simpli writen:
Код:
QueryFinished()
{
  print("2");
}