summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/base.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index ad54af46ad..416a6293f5 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -347,8 +347,13 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def create_cursor(self):
return self.connection.cursor(factory=SQLiteCursorWrapper)
- def is_usable(self):
- return True
+ def close(self):
+ self.validate_thread_sharing()
+ # If database is in memory, closing the connection destroys the
+ # database. To prevent accidental data loss, ignore close requests on
+ # an in-memory db.
+ if self.settings_dict['NAME'] != ":memory:":
+ BaseDatabaseWrapper.close(self)
def check_constraints(self, table_names=None):
"""
@@ -384,13 +389,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
% (table_name, bad_row[0], table_name, column_name, bad_row[1],
referenced_table_name, referenced_column_name))
- def close(self):
- self.validate_thread_sharing()
- # If database is in memory, closing the connection destroys the
- # database. To prevent accidental data loss, ignore close requests on
- # an in-memory db.
- if self.settings_dict['NAME'] != ":memory:":
- BaseDatabaseWrapper.close(self)
+ def is_usable(self):
+ return True
+
FORMAT_QMARK_REGEX = re.compile(r'(?<!%)%s')