main
Last change
on this file was
42bd667,
checked in by David Fuertes <dfuertes@…>, 4 years ago
|
Historial Limpio
|
-
Property mode set to
100755
|
File size:
954 bytes
|
Line | |
---|
1 | import os |
---|
2 | |
---|
3 | DEFAULT_URI = os.getenv("DB", "sqlite:memory") |
---|
4 | IS_IMAP = "imap" in DEFAULT_URI |
---|
5 | IS_GAE = "datastore" in DEFAULT_URI |
---|
6 | IS_MONGODB = "mongodb" in DEFAULT_URI |
---|
7 | IS_POSTGRESQL = "postgres" in DEFAULT_URI |
---|
8 | IS_SQLITE = "sqlite" in DEFAULT_URI |
---|
9 | IS_MSSQL = "mssql" in DEFAULT_URI |
---|
10 | IS_MYSQL = "mysql" in DEFAULT_URI |
---|
11 | IS_TERADATA = "teradata" in DEFAULT_URI |
---|
12 | IS_ORACLE = "oracle" in DEFAULT_URI |
---|
13 | IS_NOSQL = IS_GAE or IS_MONGODB or IS_IMAP |
---|
14 | |
---|
15 | |
---|
16 | def drop(table, cascade=None): |
---|
17 | if IS_NOSQL and not IS_MONGODB: |
---|
18 | # GAE drop/cleanup is not implemented |
---|
19 | db = table._db |
---|
20 | db[table]._common_filter = None |
---|
21 | db(table).delete() |
---|
22 | del db[table._tablename] |
---|
23 | del db.tables[db.tables.index(table._tablename)] |
---|
24 | db._remove_references_to(table) |
---|
25 | else: |
---|
26 | if cascade: |
---|
27 | table.drop(cascade) |
---|
28 | else: |
---|
29 | table.drop() |
---|
30 | |
---|
31 | |
---|
32 | def _quote(db, value): |
---|
33 | return db._adapter.dialect.__class__.quote_template % value |
---|
Note: See
TracBrowser
for help on using the repository browser.