Open dotSILENT opened 5 years ago
Yeah, OnQueryError
gets only called for mysql_tquery
and mysql_pquery
.
I'll look into this. I'm currently not sure if I'll add a call to OnQueryError
, because you can use mysql_errno
and mysql_error
to check for errors after an unthreaded query. However, having a central callback for all query errors (including ORM-generated queries, as they currently also do not call any error callback) would make it easier to use for everyone.
OnQueryError isn't being called for errors thrown from mysql_query() (unthreaded) Errors are being logged to the mysql.log file, but the callback isn't getting called. Haven't checked it on Linux yet, but I'm assuming it may be the same. Detecting query-specific errors is kinda useful, for example when you don't want to corrupt/loose the data of the players. I normally crashed the server in case of any error in StrickenKid's plugin, would like to do the same here. And while threaded queries are often better, there are many places where they aren't really needed (for example loading data under OnGameModeInit), or using them is just too much of a trouble (creating another callback).
I've set up a clean server with a very simple script:
And I actually misspelled the credentials, and the callback wasn't called at all. Not even once, despite outputting all the errors in mysql.log:
After succesfully connecting, it still hasn't triggered even once, despite obvious errors:
[03:07:26] [ERROR] error #1064 while executing query "SELECT AAAAAAAA(*) FORM nonexistenttable;": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '*) FORM nonexistenttable' at line 1
After changing any of the queries above to use mysql_tquery(), the callback was called succesfully (but only for _tquery)