I'm running heavily modified version of admin_sql.sma... admins are not loaded into array but mysql-queried every time someone connects. Everything is running fine, except one thing...
When someone connects with nick like "punk'o'matic" I get error:
Code:
L 03/17/2005 - 14:34:04: [AMXX] Native error in "dbi_query" on line 141 (plugin "admin.amxx").
L 03/17/2005 - 14:34:04: [MYSQL] Invalid database handle -1
L 03/17/2005 - 14:34:04: [AMXX] Debug Trace =>
L 03/17/2005 - 14:34:04: [AMXX] [0] Line 141, File "admin.sma"
L 03/17/2005 - 14:34:04: [AMXX] [1] Line 208, File "admin.sma"
L 03/17/2005 - 14:34:04: [AMXX] [2] Line 250, File "admin.sma"
L 03/17/2005 - 14:34:04: [AMXX] Native error in "dbi_num_rows" on line 156 (file "admin.sma").
L 03/17/2005 - 14:34:04: [MYSQL] Invalid result handle -6
L 03/17/2005 - 14:34:04: [AMXX] Native error in "dbi_free_result" on line 194 (file "admin.sma").
L 03/17/2005 - 14:34:04: [MYSQL] Invalid result handle -6
L 03/17/2005 - 14:34:04: [AMXX] Native error in "dbi_close" on line 195 (file "admin.sma").
L 03/17/2005 - 14:34:04: [MYSQL] Invalid database handle -1
The weird thing is that it does work, if someone connects with nick "I'm gay" or something (one quote only)...
I used to escape single quote characters, but then I realised that you cannot use double quotes in your nick, so I changed my query and now it looks like this:
Code:
format(query, 511, "SELECT `flags`,`access`,`password` FROM `admins` WHERE `name`=^"%s^"", name)
new Result:Res = dbi_query(sql, query)
It doesn't matter if I escape quotes with \ or not, it still doesn't work... but it works if I execute this query in mysql console screen
So, I guess this is some dbi bug or I'm doing something wrong?