1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

magic-removal: Fixed #1082 -- Added a 'supports_constraints' variable for each database backend, and set SQLite's to False

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1757 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-12-21 02:58:20 +00:00
parent aa9fa3408d
commit 2d4acdc278
5 changed files with 21 additions and 12 deletions

View File

@ -117,6 +117,7 @@ def get_sql_create(app):
# Take care of any ALTER TABLE statements to add constraints
# after the fact.
if backend.supports_constraints:
if klass in pending_references:
for rel_class, f in pending_references[klass]:
rel_opts = rel_class._meta

View File

@ -76,6 +76,8 @@ class DatabaseWrapper:
self.connection.close()
self.connection = None
supports_constraints = True
def quote_name(name):
if name.startswith('[') and name.endswith(']'):
return name # Quoting once is enough.

View File

@ -83,6 +83,8 @@ class DatabaseWrapper:
self.connection.close()
self.connection = None
supports_constraints = True
def quote_name(name):
if name.startswith("`") and name.endswith("`"):
return name # Quoting once is enough.

View File

@ -49,6 +49,8 @@ class DatabaseWrapper:
self.connection.close()
self.connection = None
supports_constraints = True
def quote_name(name):
if name.startswith('"') and name.endswith('"'):
return name # Quoting once is enough.

View File

@ -70,6 +70,8 @@ class SQLiteCursorWrapper(Database.Cursor):
# XXX this seems too simple to be correct... is this right?
return query % tuple("?" * num_params)
supports_constraints = False
def quote_name(name):
if name.startswith('"') and name.endswith('"'):
return name # Quoting once is enough.