mirror of
https://github.com/django/django.git
synced 2025-06-10 05:59:13 +00:00
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')
|
__all__ = ('backend', 'connection', 'DatabaseError')
|
||||||
|
|
||||||
if not DATABASE_ENGINE:
|
if not DATABASE_ENGINE:
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
DATABASE_ENGINE = 'dummy'
|
||||||
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
backend = __import__('django.db.backends.%s.base' % DATABASE_ENGINE, '', '', [''])
|
backend = __import__('django.db.backends.%s.base' % DATABASE_ENGINE, '', '', [''])
|
||||||
|
0
django/db/backends/dummy/__init__.py
Normal file
0
django/db/backends/dummy/__init__.py
Normal file
36
django/db/backends/dummy/base.py
Normal file
36
django/db/backends/dummy/base.py
Normal file
@ -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 = {}
|
1
django/db/backends/dummy/creation.py
Normal file
1
django/db/backends/dummy/creation.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
DATA_TYPES = {}
|
7
django/db/backends/dummy/introspection.py
Normal file
7
django/db/backends/dummy/introspection.py
Normal file
@ -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…
x
Reference in New Issue
Block a user