summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Bandet <gbandet@multiposting.fr>2013-11-05 11:34:43 +0100
committerGuillaume Bandet <gbandet@multiposting.fr>2013-11-05 11:34:43 +0100
commit8096d8c0530b6c5ccec671c4746d0f94b4831790 (patch)
treeb9acd032d684de97c600fb6aa83a8922f7c71e1e
parent8bef3359fb27b63cf608a6685a99ed77fa766e5a (diff)
downloadmysqldb1-8096d8c0530b6c5ccec671c4746d0f94b4831790.tar.gz
Also fix executemany().
-rw-r--r--MySQLdb/cursors.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/MySQLdb/cursors.py b/MySQLdb/cursors.py
index 9797d4a..7c01870 100644
--- a/MySQLdb/cursors.py
+++ b/MySQLdb/cursors.py
@@ -240,7 +240,13 @@ class BaseCursor(object):
e = m.end(1)
qv = m.group(1)
try:
- q = [ qv % db.literal(a) for a in args ]
+ q = []
+ for a in args:
+ if isinstance(a, dict):
+ q.append(qv % dict((key, db.literal(item))
+ for key, item in a.iteritems()))
+ else:
+ q.append(qv % tuple([db.literal(item) for item in a]))
except TypeError, msg:
if msg.args[0] in ("not enough arguments for format string",
"not all arguments converted"):