Return a Query-Callback result - 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: Return a Query-Callback result (
/showthread.php?tid=612371)
Return a Query-Callback result -
OwlIT - 17.07.2016
Hi, is there a method to return a query-callback result? For example:
Код:
test()
{
mysql_tquery(connectionHandle, "SELECT * FROM `example`", "foo", "");
//HERE I WANT TO KNOW WHAT FOO GAVE BACK
}
foo()
{
if(cache_num_rows() > 0)
return 1;
return 0;
}
Re: Return a Query-Callback result -
Konstantinos - 17.07.2016
If you want to just check if there is any row, use "SELECT COUNT(*) FROM ..." and retrieve the rows returned with cache_get_row_int (rowid 0). That way, you won't select ALL the data for nothing.
For now, if you want to have a function that returns 0/1 the only way is non-threaded queries. In R40, there'll be support for references by the way.
Re: Return a Query-Callback result -
OwlIT - 17.07.2016
As I expected.. thanks for the answer!