magic-removal: Added 'dummy' database backend, which is used as a fallback if DATABASE_ENGINE isn't set
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b72373a7fd
commit
189cb2800f
|
@ -3,8 +3,7 @@ from django.conf.settings import DATABASE_ENGINE
|
|||
__all__ = ('backend', 'connection', 'DatabaseError')
|
||||
|
||||
if not DATABASE_ENGINE:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
|
||||
DATABASE_ENGINE = 'dummy'
|
||||
|
||||
try:
|
||||
backend = __import__('django.db.backends.%s.base' % DATABASE_ENGINE, '', '', [''])
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
Dummy database backend for Django.
|
||||
|
||||
Django uses this if the DATABASE_ENGINE setting is empty (None or empty string).
|
||||
|
||||
Each of these API functions, except connection.close(), raises
|
||||
ImproperlyConfigured.
|
||||
"""
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
def complain(*args, **kwargs):
|
||||
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
|
||||
|
||||
class DatabaseError(Exception):
|
||||
pass
|
||||
|
||||
class DatabaseWrapper:
|
||||
cursor = complain
|
||||
commit = complain
|
||||
rollback = complain
|
||||
|
||||
def close(self):
|
||||
pass # close()
|
||||
|
||||
supports_constraints = False
|
||||
quote_name = complain
|
||||
dictfetchone = complain
|
||||
dictfetchmany = complain
|
||||
dictfetchall = complain
|
||||
get_last_insert_id = complain
|
||||
get_date_extract_sql = complain
|
||||
get_date_trunc_sql = complain
|
||||
get_limit_offset_sql = complain
|
||||
get_random_function_sql = complain
|
||||
OPERATOR_MAPPING = {}
|
|
@ -0,0 +1 @@
|
|||
DATA_TYPES = {}
|
|
@ -0,0 +1,7 @@
|
|||
from django.db.backends.dummy.base import complain
|
||||
|
||||
get_table_list = complain
|
||||
get_table_description = complain
|
||||
get_relations = complain
|
||||
|
||||
DATA_TYPES_REVERSE = {}
|
Loading…
Reference in New Issue