summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-08-20 00:15:53 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-08-20 00:15:53 +0000
commitaaed6e04eceef98e9ec433e86b80486ada2a668b (patch)
tree1af09d368aa36673b6b1768a70ac10f8cb9f0fea /django/db/backends/sqlite3
parentc44fb66551bf2f628648440ebc2010ad1135d9ac (diff)
Refactored get_sql_flush() to DatabaseOperations.sql_flush(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/base.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 0ab928dfc4..ce3a0e719a 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -51,6 +51,19 @@ class DatabaseOperations(BaseDatabaseOperations):
def pk_default_value(self):
return 'NULL'
+ 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
+ # because constraints don't exist
+ sql = ['%s %s %s;' % \
+ (style.SQL_KEYWORD('DELETE'),
+ style.SQL_KEYWORD('FROM'),
+ style.SQL_FIELD(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
+ return sql
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -121,24 +134,6 @@ def _sqlite_extract(lookup_type, dt):
def get_start_transaction_sql():
return "BEGIN;"
-def get_sql_flush(style, tables, sequences):
- """
- Return a list of SQL statements required to remove all data from
- all tables in the database (without actually removing the tables
- themselves) and put the database in an empty 'initial' state
- """
- # NB: The generated SQL below is specific to SQLite
- # Note: The DELETE FROM... SQL generated below works for SQLite databases
- # because constraints don't exist
- sql = ['%s %s %s;' % \
- (style.SQL_KEYWORD('DELETE'),
- style.SQL_KEYWORD('FROM'),
- style.SQL_FIELD(quote_name(table))
- ) for table in tables]
- # Note: No requirement for reset of auto-incremented indices (cf. other
- # get_sql_flush() implementations). Just return SQL at this point
- return sql
-
def get_sql_sequence_reset(style, model_list):
"Returns a list of the SQL statements to reset sequences for the given models."
# No sequence reset required