Fixed #411 -- CursorDebugWrapper now supports pyformat paramstyle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3038 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
350c360776
commit
5c5d60aa63
|
@ -12,6 +12,10 @@ class CursorDebugWrapper:
|
||||||
return self.cursor.execute(sql, params)
|
return self.cursor.execute(sql, params)
|
||||||
finally:
|
finally:
|
||||||
stop = time()
|
stop = time()
|
||||||
|
# If params was a list, convert it to a tuple, because string
|
||||||
|
# formatting with '%' only works with tuples or dicts.
|
||||||
|
if not isinstance(params, (tuple, dict)):
|
||||||
|
params = tuple(params)
|
||||||
self.db.queries.append({
|
self.db.queries.append({
|
||||||
'sql': sql % tuple(params),
|
'sql': sql % tuple(params),
|
||||||
'time': "%.3f" % (stop - start),
|
'time': "%.3f" % (stop - start),
|
||||||
|
|
Loading…
Reference in New Issue