dbi buggy?
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").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)So, I guess this is some dbi bug or I'm doing something wrong? |
First off, I'd guess your plugin is lacking serious error checking. If you have a -1 connection handle and then try to execute more statements, it's obviously not going to work. Every single time you get a return value you should be checking it along the way.
As for the actual query, you should use server_print or something to dump it to the screen, to make sure it's being formatted correctly. |
ok i found the cause of the error... its `ip`... i skipped that, because i thought its not important :oops:
it is used as function parameter: getAccess(id,name[],authid[],ip[], password[]) ip is used inside this function and is part of query: dbi_query(sql, "SELECT ... ... (`auth`=^"%s^" AND INSTR(flags,'d')) ... ...", ip ) when i take out this part, there is no more errors... im confused :? updated. this one crashes server instantly: Code:
format(qry, 511, "SELECT `auth`,`password`,`access`,`flags` FROM `%s` WHERE (`auth`=^"%s^" AND INSTR(flags,'d'))", table, ip) |
hmmmmmmmmmm it doesn't even work if i execute following query:
Code:
new theip[16]Code:
L 03/17/2005 - 18:29:09: "kexz<1><VALVE_ID_LAN><>" connected, address "192.168.0.2:27005" |
ok finally i found cause of all this...
whenever I try to execute query with params witch contains dot (like auth='ke.xz') and row exists, it crashes... this only happens when I try to assing query results to Result:Res variable... it MUST be dbi issue |
ok after 4 hours of experimenting, i finally got a solution... actually it wasnt Result:Res problem, but dbi_result
after getting first param `auth` ( dbi_result(Res,"auth", qAuth, 31) ) i could not read second one, which is password, nor third or fourth (access, flags)... the thing is that dbi_field() works perfectly... but WHY?!?!?! |
| All times are GMT -4. The time now is 13:57. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.