MySQL - checking result
#1

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.
Reply
#2

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").
Reply
#3

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.
Reply
#4

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.
Reply
#5

Thanks very much.
https://sampwiki.blast.hk/wiki/MySQL/R33 helped me a lot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)