From 1b4cfd4fea151da70a77c9ca6197276110aa8c31 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 20 Aug 2007 01:13:12 +0000 Subject: [PATCH] Removed backend.dictfetchone(), as it wasn't being used anywhere git-svn-id: http://code.djangoproject.com/svn/django/trunk@5968 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/__init__.py | 4 ++++ django/db/backends/ado_mssql/base.py | 1 - django/db/backends/dummy/base.py | 1 - django/db/backends/mysql/base.py | 1 - django/db/backends/mysql_old/base.py | 1 - django/db/backends/oracle/base.py | 1 - django/db/backends/postgresql/base.py | 4 ---- django/db/backends/postgresql_psycopg2/base.py | 1 - django/db/backends/sqlite3/base.py | 1 - django/db/backends/util.py | 7 ------- 10 files changed, 4 insertions(+), 18 deletions(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 632dd36639..3baf752ec4 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -5,6 +5,10 @@ except ImportError: # Import copy of _thread_local.py from Python 2.4 from django.utils._threading_local import local +def _dict_helper(desc, row): + "Returns a dictionary for the given cursor.description and result row." + return dict(zip([col[0] for col in desc], row)) + class BaseDatabaseWrapper(local): """ Represents a database connection. diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py index 2c6149bf38..98c68f1919 100644 --- a/django/db/backends/ado_mssql/base.py +++ b/django/db/backends/ado_mssql/base.py @@ -102,7 +102,6 @@ supports_constraints = True supports_tablespaces = True uses_case_insensitive_names = False -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/dummy/base.py b/django/db/backends/dummy/base.py index 7c1341b6d6..0d83785e83 100644 --- a/django/db/backends/dummy/base.py +++ b/django/db/backends/dummy/base.py @@ -39,7 +39,6 @@ class DatabaseWrapper(object): supports_constraints = False supports_tablespaces = False -dictfetchone = complain dictfetchmany = complain dictfetchall = complain diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 124c3c8a33..5c19e301f5 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -184,7 +184,6 @@ supports_constraints = True supports_tablespaces = False uses_case_insensitive_names = False -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/mysql_old/base.py b/django/db/backends/mysql_old/base.py index 85c1beb558..bd3b382007 100644 --- a/django/db/backends/mysql_old/base.py +++ b/django/db/backends/mysql_old/base.py @@ -203,7 +203,6 @@ supports_constraints = True supports_tablespaces = False uses_case_insensitive_names = False -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 0ad289c2c2..eca0e2e1ea 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -224,7 +224,6 @@ def to_unicode(s): return force_unicode(s) return s -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 3d7e7515d3..43f06f83fe 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -200,10 +200,6 @@ supports_constraints = True supports_tablespaces = False uses_case_insensitive_names = False -def dictfetchone(cursor): - "Returns a row from the cursor as a dict" - return cursor.dictfetchone() - def dictfetchmany(cursor, number): "Returns a certain number of rows from a cursor as a dict" return cursor.dictfetchmany(number) diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 152f31d88c..ddc00f85fa 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -163,7 +163,6 @@ supports_constraints = True supports_tablespaces = False uses_case_insensitive_names = False -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 7d291480a5..1c8409879d 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -120,7 +120,6 @@ supports_constraints = False supports_tablespaces = False uses_case_insensitive_names = False -dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall diff --git a/django/db/backends/util.py b/django/db/backends/util.py index 4de7c517d6..e022380390 100644 --- a/django/db/backends/util.py +++ b/django/db/backends/util.py @@ -133,13 +133,6 @@ def _dict_helper(desc, row): "Returns a dictionary for the given cursor.description and result row." return dict(zip([col[0] for col in desc], row)) -def dictfetchone(cursor): - "Returns a row from the cursor as a dict" - row = cursor.fetchone() - if not row: - return None - return _dict_helper(cursor.description, row) - def dictfetchmany(cursor, number): "Returns a certain number of rows from a cursor as a dict" desc = cursor.description