MySQL Threaded Query Help - 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 Threaded Query Help (
/showthread.php?tid=504363)
MySQL Threaded Query Help -
unSatisfied - 03.04.2014
How would i set iRows (in stock MySQL_NameExists) to the value that is being returned in NameExistsCheck?
Код:
stock MySQL_NameExists(const account[])
{
new
szQuery[128],
iRows = 0;
mysql_tquery(MySQL, "SELECT * FROM `accounts` WHERE `Name` = 'Bryan'", "NameExistsCheck()", "", "");
//Set iRows to rows in NameExistsCheck()
printf("Rows for name exists: '%d'", iRows);
return iRows;
}
forward NameExistsCheck();
public NameExistsCheck()
{
new rows = cache_get_row_count();
printf("Rows for name exists2: '%d'", rows);
if(rows >= 1) {
rows = 1;
}
else {
rows = 0;
}
return rows;
}
Re: MySQL Threaded Query Help -
Vince - 03.04.2014
It doesn't work like that. Such constructs aren't at all possible with threaded queries. Y_inline is probably the closest you can get.
The public function doesn't actually return program flow to the place it was initiated. That's pretty much the whole point of threads. The main server thread doesn't have to wait for the query and as soon as the query gets sent the server continues to do other stuff.
Re: MySQL Threaded Query Help -
unSatisfied - 03.04.2014
Okay but if i use mysql_query won't the server freeze?
EDIT: I'll just put the rest of the coding in that function for registration/login. Not sure why i didn't think of that in the first place. Thanks for the response anyway!