Bug #66685 | parameter subsitution in UPDATE statement causes syntax error | ||
---|---|---|---|
Submitted: | 4 Sep 2012 14:40 | Modified: | 6 Sep 2012 6:09 |
Reporter: | an p | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / Python | Severity: | S3 (Non-critical) |
Version: | 1.0.5 | OS: | MacOS |
Assigned to: | CPU Architecture: | Any | |
Tags: | MySQL, python, update statement |
[4 Sep 2012 14:40]
an p
[6 Sep 2012 6:09]
Geert Vanderkelen
You can not pass identifiers as parameters. Only variables should be passed as parameters to execute() or executemany(). Consequently, this is not a bug. If you want to make the field names dynamic, you can do something like this: update = ( "UPDATE clients_users SET %s = %%s " "WHERE user_name = %%s AND signature = %%s" ) % (key,) self.c.execute(update, (value, userName, signature))