|
1 """ |
|
2 Dummy database backend for Django. |
|
3 |
|
4 Django uses this if the DATABASE_ENGINE setting is empty (None or empty string). |
|
5 |
|
6 Each of these API functions, except connection.close(), raises |
|
7 ImproperlyConfigured. |
|
8 """ |
|
9 |
|
10 from django.core.exceptions import ImproperlyConfigured |
|
11 from django.db.backends import * |
|
12 from django.db.backends.creation import BaseDatabaseCreation |
|
13 |
|
14 def complain(*args, **kwargs): |
|
15 raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet." |
|
16 |
|
17 def ignore(*args, **kwargs): |
|
18 pass |
|
19 |
|
20 class DatabaseError(Exception): |
|
21 pass |
|
22 |
|
23 class IntegrityError(DatabaseError): |
|
24 pass |
|
25 |
|
26 class DatabaseOperations(BaseDatabaseOperations): |
|
27 quote_name = complain |
|
28 |
|
29 class DatabaseClient(BaseDatabaseClient): |
|
30 runshell = complain |
|
31 |
|
32 class DatabaseIntrospection(BaseDatabaseIntrospection): |
|
33 get_table_list = complain |
|
34 get_table_description = complain |
|
35 get_relations = complain |
|
36 get_indexes = complain |
|
37 |
|
38 class DatabaseWrapper(object): |
|
39 operators = {} |
|
40 cursor = complain |
|
41 _commit = complain |
|
42 _rollback = ignore |
|
43 |
|
44 def __init__(self, *args, **kwargs): |
|
45 self.features = BaseDatabaseFeatures() |
|
46 self.ops = DatabaseOperations() |
|
47 self.client = DatabaseClient(self) |
|
48 self.creation = BaseDatabaseCreation(self) |
|
49 self.introspection = DatabaseIntrospection(self) |
|
50 self.validation = BaseDatabaseValidation() |
|
51 |
|
52 def close(self): |
|
53 pass |