diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-08-20 00:30:19 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-08-20 00:30:19 +0000 |
| commit | d4f218bd91d08ed79fcc67c10f4e1cfc6b221784 (patch) | |
| tree | 752217d54feb37b974e831720b2ad0323db6db18 /django/db/backends | |
| parent | 13061bf20bc467c5655c2dfa280dc226a00effcd (diff) | |
Refactored get_tablespace_sql() to DatabaseOperations.tablespace_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends')
| -rw-r--r-- | django/db/backends/__init__.py | 7 | ||||
| -rw-r--r-- | django/db/backends/ado_mssql/base.py | 6 | ||||
| -rw-r--r-- | django/db/backends/oracle/base.py | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 8af82a4dda..78dc506add 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -166,3 +166,10 @@ class BaseDatabaseOperations(object): Returns the SQL statement required to start a transaction. """ return "BEGIN;" + + def tablespace_sql(self, tablespace, inline=False): + """ + Returns the tablespace SQL, or None if the backend doesn't use + tablespaces. + """ + return None diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py index 192c069449..4898d38341 100644 --- a/django/db/backends/ado_mssql/base.py +++ b/django/db/backends/ado_mssql/base.py @@ -70,6 +70,9 @@ class DatabaseOperations(BaseDatabaseOperations): def random_function_sql(self): return 'RAND()' + def tablespace_sql(self, tablespace, inline=False): + return "ON %s" % quote_name(tablespace) + class DatabaseWrapper(BaseDatabaseWrapper): ops = DatabaseOperations() @@ -103,9 +106,6 @@ dictfetchone = util.dictfetchone dictfetchmany = util.dictfetchmany dictfetchall = util.dictfetchall -def get_tablespace_sql(tablespace, inline=False): - return "ON %s" % quote_name(tablespace) - OPERATOR_MAPPING = { 'exact': '= %s', 'iexact': 'LIKE %s', diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index b84dc48bbe..0c9a0a55b0 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -115,6 +115,9 @@ class DatabaseOperations(BaseDatabaseOperations): def start_transaction_sql(self): return '' + def tablespace_sql(self, tablespace, inline=False): + return "%sTABLESPACE %s" % ((inline and "USING INDEX " or ""), quote_name(tablespace)) + class DatabaseWrapper(BaseDatabaseWrapper): ops = DatabaseOperations() @@ -231,9 +234,6 @@ def get_field_cast_sql(db_type): else: return "%s%s" -def get_tablespace_sql(tablespace, inline=False): - return "%sTABLESPACE %s" % ((inline and "USING INDEX " or ""), quote_name(tablespace)) - def get_drop_sequence(table): return "DROP SEQUENCE %s;" % quote_name(get_sequence_name(table)) |
