summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-08-20 01:03:33 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-08-20 01:03:33 +0000
commit221f99ed5831b71b7ddb810ec8808a884773ef04 (patch)
tree807edbb6708a2c0530e22d9cca3b9b0adf5da6f0 /django/db/backends/sqlite3
parentd4f218bd91d08ed79fcc67c10f4e1cfc6b221784 (diff)
Refactored quote_name() to DatabaseOperations.quote_name(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/base.py12
-rw-r--r--django/db/backends/sqlite3/introspection.py4
2 files changed, 9 insertions, 7 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index a48ff3a93c..7d291480a5 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -51,6 +51,11 @@ class DatabaseOperations(BaseDatabaseOperations):
def pk_default_value(self):
return 'NULL'
+ def quote_name(self, name):
+ if name.startswith('"') and name.endswith('"'):
+ return name # Quoting once is enough.
+ return '"%s"' % name
+
def sql_flush(self, style, tables, sequences):
# NB: The generated SQL below is specific to SQLite
# Note: The DELETE FROM... SQL generated below works for SQLite databases
@@ -58,7 +63,7 @@ class DatabaseOperations(BaseDatabaseOperations):
sql = ['%s %s %s;' % \
(style.SQL_KEYWORD('DELETE'),
style.SQL_KEYWORD('FROM'),
- style.SQL_FIELD(quote_name(table))
+ style.SQL_FIELD(self.quote_name(table))
) for table in tables]
# Note: No requirement for reset of auto-incremented indices (cf. other
# sql_flush() implementations). Just return SQL at this point
@@ -115,11 +120,6 @@ supports_constraints = False
supports_tablespaces = False
uses_case_insensitive_names = False
-def quote_name(name):
- if name.startswith('"') and name.endswith('"'):
- return name # Quoting once is enough.
- return '"%s"' % name
-
dictfetchone = util.dictfetchone
dictfetchmany = util.dictfetchmany
dictfetchall = util.dictfetchall
diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py
index cb2fbb8ee0..52b880aac2 100644
--- a/django/db/backends/sqlite3/introspection.py
+++ b/django/db/backends/sqlite3/introspection.py
@@ -1,4 +1,6 @@
-from django.db.backends.sqlite3.base import quote_name
+from django.db.backends.sqlite3.base import DatabaseOperations
+
+quote_name = DatabaseOperations().quote_name
def get_table_list(cursor):
"Returns a list of table names in the current database."