gm_tmysql4
gm_tmysql4 copied to clipboard
Query callback not called on failure
When executing a query that fails, the callback is not triggered. In version 4.0, the callback was called regardless of the query result. Would it be possible to restore this behavior pls ?

I don't know if it's because I'm on a local 32-bit Windows server, but it doesn't print anything to me and this only happens with versions higher than 4.0
require("tmysql4")
database = database or {}
database.handle = database.handle or nil
database.error = database.error or nil
database.handle, database.error = tmysql.Connect("localhost", "root", "", "server", 3306)
if database.error then print("Error: ", database.error) return end
print("start")
database.handle:Query("CREATE TABLE IF NOT EXISTS `test` (`id` CHAR(50) PRIMARY KEY, `value` TEXT);")
database.handle:Query("SELECT * FROM `test`", PrintTable)
In this example, no print is placed in my console apart from print("start"). And the first query proves that the connection works very well
You need to manually poll the connection in this version.
hook.Add('Think', database.handle, database.handle.Poll)