2006-05-02 09:31:56 +08:00
|
|
|
"""
|
|
|
|
Dummy database backend for Django.
|
|
|
|
|
2009-12-22 23:18:51 +08:00
|
|
|
Django uses this if the database ENGINE setting is empty (None or empty string).
|
2006-05-02 09:31:56 +08:00
|
|
|
|
|
|
|
Each of these API functions, except connection.close(), raises
|
|
|
|
ImproperlyConfigured.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.core.exceptions import ImproperlyConfigured
|
2015-01-13 04:20:40 +08:00
|
|
|
from django.db.backends.base.base import BaseDatabaseWrapper
|
|
|
|
from django.db.backends.base.client import BaseDatabaseClient
|
|
|
|
from django.db.backends.base.creation import BaseDatabaseCreation
|
|
|
|
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.db.backends.base.operations import BaseDatabaseOperations
|
2015-03-13 00:17:15 +08:00
|
|
|
from django.db.backends.dummy.features import DummyDatabaseFeatures
|
2006-05-02 09:31:56 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2006-05-02 09:31:56 +08:00
|
|
|
def complain(*args, **kwargs):
|
2012-03-13 05:58:07 +08:00
|
|
|
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
|
|
|
|
"Please supply the ENGINE value. Check "
|
|
|
|
"settings documentation for more details.")
|
2006-05-02 09:31:56 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2007-06-02 00:30:38 +08:00
|
|
|
def ignore(*args, **kwargs):
|
|
|
|
pass
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2007-08-26 02:27:57 +08:00
|
|
|
class DatabaseOperations(BaseDatabaseOperations):
|
|
|
|
quote_name = complain
|
2007-08-20 06:29:57 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2008-08-11 20:11:25 +08:00
|
|
|
class DatabaseClient(BaseDatabaseClient):
|
|
|
|
runshell = complain
|
2009-03-12 16:52:42 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2013-01-04 20:55:20 +08:00
|
|
|
class DatabaseCreation(BaseDatabaseCreation):
|
|
|
|
create_test_db = ignore
|
|
|
|
destroy_test_db = ignore
|
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2008-08-11 20:11:25 +08:00
|
|
|
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
|
|
|
get_table_list = complain
|
|
|
|
get_table_description = complain
|
|
|
|
get_relations = complain
|
|
|
|
get_indexes = complain
|
2011-08-07 08:43:26 +08:00
|
|
|
get_key_columns = complain
|
2009-03-12 16:52:42 +08:00
|
|
|
|
2013-07-08 08:39:54 +08:00
|
|
|
|
2011-02-14 08:07:09 +08:00
|
|
|
class DatabaseWrapper(BaseDatabaseWrapper):
|
2007-08-20 11:26:55 +08:00
|
|
|
operators = {}
|
2011-02-14 08:07:09 +08:00
|
|
|
# Override the base class implementations with null
|
|
|
|
# implementations. Anything that tries to actually
|
|
|
|
# do something raises complain; anything that tries
|
|
|
|
# to rollback or undo something raises ignore.
|
2013-03-02 19:12:51 +08:00
|
|
|
_cursor = complain
|
2014-12-27 23:19:32 +08:00
|
|
|
ensure_connection = complain
|
2006-05-02 09:31:56 +08:00
|
|
|
_commit = complain
|
2007-06-02 00:30:38 +08:00
|
|
|
_rollback = ignore
|
2013-03-02 19:12:51 +08:00
|
|
|
_close = ignore
|
|
|
|
_savepoint = ignore
|
|
|
|
_savepoint_commit = complain
|
|
|
|
_savepoint_rollback = ignore
|
2013-03-02 20:47:46 +08:00
|
|
|
_set_autocommit = complain
|
2016-09-09 04:33:36 +08:00
|
|
|
# Classes instantiated in __init__().
|
|
|
|
client_class = DatabaseClient
|
|
|
|
creation_class = DatabaseCreation
|
|
|
|
features_class = DummyDatabaseFeatures
|
|
|
|
introspection_class = DatabaseIntrospection
|
|
|
|
ops_class = DatabaseOperations
|
2013-03-07 21:53:52 +08:00
|
|
|
|
|
|
|
def is_usable(self):
|
|
|
|
return True
|