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
|
2008-08-11 20:11:25 +08:00
|
|
|
from django.db.backends import *
|
|
|
|
from django.db.backends.creation import BaseDatabaseCreation
|
2006-05-02 09:31:56 +08:00
|
|
|
|
|
|
|
def complain(*args, **kwargs):
|
2010-01-11 02:36:20 +08:00
|
|
|
raise ImproperlyConfigured("You haven't set the database ENGINE setting yet.")
|
2006-05-02 09:31:56 +08:00
|
|
|
|
2007-06-02 00:30:38 +08:00
|
|
|
def ignore(*args, **kwargs):
|
|
|
|
pass
|
|
|
|
|
2006-05-02 09:31:56 +08:00
|
|
|
class DatabaseError(Exception):
|
|
|
|
pass
|
|
|
|
|
2007-04-25 18:18:56 +08:00
|
|
|
class IntegrityError(DatabaseError):
|
|
|
|
pass
|
|
|
|
|
2007-08-26 02:27:57 +08:00
|
|
|
class DatabaseOperations(BaseDatabaseOperations):
|
|
|
|
quote_name = complain
|
2007-08-20 06:29:57 +08:00
|
|
|
|
2008-08-11 20:11:25 +08:00
|
|
|
class DatabaseClient(BaseDatabaseClient):
|
|
|
|
runshell = complain
|
2009-03-12 16:52:42 +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
|
2009-03-12 16:52:42 +08:00
|
|
|
|
|
|
|
class DatabaseWrapper(object):
|
2007-08-20 11:26:55 +08:00
|
|
|
operators = {}
|
2006-05-02 09:31:56 +08:00
|
|
|
cursor = complain
|
|
|
|
_commit = complain
|
2007-06-02 00:30:38 +08:00
|
|
|
_rollback = ignore
|
2006-05-02 09:31:56 +08:00
|
|
|
|
2009-12-24 13:57:43 +08:00
|
|
|
def __init__(self, settings_dict, alias, *args, **kwargs):
|
2008-08-11 20:11:25 +08:00
|
|
|
self.features = BaseDatabaseFeatures()
|
|
|
|
self.ops = DatabaseOperations()
|
2009-03-11 11:39:34 +08:00
|
|
|
self.client = DatabaseClient(self)
|
2008-08-11 20:11:25 +08:00
|
|
|
self.creation = BaseDatabaseCreation(self)
|
|
|
|
self.introspection = DatabaseIntrospection(self)
|
2009-12-24 13:57:43 +08:00
|
|
|
self.validation = BaseDatabaseValidation(self)
|
|
|
|
|
|
|
|
self.settings_dict = settings_dict
|
|
|
|
self.alias = alias
|
2006-11-07 13:17:38 +08:00
|
|
|
|
2006-05-02 09:31:56 +08:00
|
|
|
def close(self):
|
2007-08-20 11:32:06 +08:00
|
|
|
pass
|