mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
magic-removal: Fixed #1624 -- Made small changes to parameters in executemany() in cursor implementations in MySQL and SQLite database backends
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2686 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6d953207ae
commit
af0056201e
@ -62,15 +62,14 @@ class SQLiteCursorWrapper(Database.Cursor):
|
||||
"""
|
||||
Django uses "format" style placeholders, but pysqlite2 uses "qmark" style.
|
||||
This fixes it -- but note that if you want to use a literal "%s" in a query,
|
||||
you'll need to use "%%s" (which I belive is true of other wrappers as well).
|
||||
you'll need to use "%%s".
|
||||
"""
|
||||
|
||||
def execute(self, query, params=[]):
|
||||
def execute(self, query, params=()):
|
||||
query = self.convert_query(query, len(params))
|
||||
return Database.Cursor.execute(self, query, params)
|
||||
|
||||
def executemany(self, query, params=[]):
|
||||
query = self.convert_query(query, len(params[0]))
|
||||
def executemany(self, query, param_list):
|
||||
query = self.convert_query(query, len(param_list[0]))
|
||||
return Database.Cursor.executemany(self, query, params)
|
||||
|
||||
def convert_query(self, query, num_params):
|
||||
|
@ -6,7 +6,7 @@ class CursorDebugWrapper:
|
||||
self.cursor = cursor
|
||||
self.db = db
|
||||
|
||||
def execute(self, sql, params=[]):
|
||||
def execute(self, sql, params=()):
|
||||
start = time()
|
||||
try:
|
||||
return self.cursor.execute(sql, params)
|
||||
|
Loading…
x
Reference in New Issue
Block a user