From af0056201e4484adaf7d91b8a061db1ec3e8f41d Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 12 Apr 2006 13:19:45 +0000 Subject: [PATCH] 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 --- django/db/backends/sqlite3/base.py | 9 ++++----- django/db/backends/util.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 699a980008..371c4b5ae5 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -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): diff --git a/django/db/backends/util.py b/django/db/backends/util.py index 98c18e9787..b9c6f573c9 100644 --- a/django/db/backends/util.py +++ b/django/db/backends/util.py @@ -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)