mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Fix the conversion of list or tuple args to a SQL.
When there is one element on the list, the generated SQL was (1,) (python notation of a single element tuple, which is not valid in SQL.
This commit is contained in:
@ -180,7 +180,10 @@ class BaseCursor(object):
|
||||
if isinstance(query, unicode):
|
||||
query = query.encode(db.unicode_literal.charset)
|
||||
if args is not None:
|
||||
query = query % db.literal(args)
|
||||
if isinstance(args, dict):
|
||||
query = query % {key: db.literal(item) for key, item in args.iteritems()}
|
||||
else:
|
||||
query = query % tuple([db.literal(item) for item in args])
|
||||
try:
|
||||
r = None
|
||||
r = self._query(query)
|
||||
|
Reference in New Issue
Block a user