MySQL - checking 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: MySQL - checking result (
/showthread.php?tid=477413)
MySQL - checking result -
Michalec - 24.11.2013
Hi. I have problem with my query (Ban System). In debug error from query exists (like 'Duplicate entry 'xxx' for key 'host''), but in code not...
Код:
mysql_function_query(mysql, formatEx("DELETE FROM `mapa_bany` WHERE `gracz` = '%s' OR `host` = '%s'", gracz, gracz), false, "", "");
if(mysql_errno() != 0 && adminid != -1) return SendClientMessage(adminid, -1, "Wystąpił problem. Ban prawdopodobnie nie istnieje lub podano błędne dane.");
Help guys, I don't know why this doesn't work. I tried to do this with inline, but my "inline callback" wasn't called. Also tried using mysql_affected_rows() and mysql_warning_count(). Getting the same.
Thanks in advance. Waiting for answer.
PS I'm using MySQL plugin (by BlueG and Pain123) R34.
Re: MySQL - checking result -
maddinat0r - 25.11.2013
mysql_tquery (and thus mysql_function_query; mysql_function_query is deprecated) sends threaded queries. What you need here are unthreaded queries, so you have to use "mysql_query". More informations on this function can be found in the SA-MP wiki (search for "MySQL/R33").
Re: MySQL - checking result -
Michalec - 25.11.2013
So I can use both mysql_tquery and mysql_query? I've readed, that using R7 and above (with threaded queries) requires ONLY threaded queries.
Now I have to replace all mysql_function_query to mysql_tquery and if I want to get result (errors etc.) I can use mysql_query?
Thanks.
Re: MySQL - checking result -
maddinat0r - 25.11.2013
Quote:
Originally Posted by Michalec
So I can use both mysql_tquery and mysql_query? I've readed, that using R7 and above (with threaded queries) requires ONLY threaded queries.
Now I have to replace all mysql_function_query to mysql_tquery and if I want to get result (errors etc.) I can use mysql_query?
Thanks.
|
Unthreaded queries were introduced in R33.
You don't need to replace all your calls to mysql_function_query with mysql_tquery, there is a wrapper for mysql_function_query in the include which calls automatically mysql_tquery (so if you call mysql_function_query you actually call mysql_tquery).
If you want to execute an unthreaded query you'll have to use mysql_query, just like in your problem you initially described.
Re: MySQL - checking result -
Michalec - 25.11.2013
Thanks very much.
https://sampwiki.blast.hk/wiki/MySQL/R33 helped me a lot