2006-05-02 09:31:56 +08:00
|
|
|
"""
|
|
|
|
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
|
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):
|
|
|
|
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
|
|
|
|
|
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
|
|
|
|
|
|
|
|
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
|
|
|
get_table_list = complain
|
|
|
|
get_table_description = complain
|
|
|
|
get_relations = complain
|
|
|
|
get_indexes = complain
|
|
|
|
|
|
|
|
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
|
|
|
|
2008-08-11 20:11:25 +08:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(DatabaseWrapper, self).__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
self.features = BaseDatabaseFeatures()
|
|
|
|
self.ops = DatabaseOperations()
|
|
|
|
self.client = DatabaseClient()
|
|
|
|
self.creation = BaseDatabaseCreation(self)
|
|
|
|
self.introspection = DatabaseIntrospection(self)
|
|
|
|
self.validation = BaseDatabaseValidation()
|
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
|