1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

boulder-oracle-sprint: Fixed DATA_TYPES_REVERSE to use cx_Oracle type

objects as keys.  Introspection works much better now.


git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters 2007-03-29 21:33:36 +00:00
parent 9649bfd4f9
commit 61c3c5bc7f
2 changed files with 11 additions and 15 deletions

View File

@ -883,7 +883,7 @@ def inspectdb():
except NotImplementedError: except NotImplementedError:
indexes = {} indexes = {}
for i, row in enumerate(introspection_module.get_table_description(cursor, table_name)): for i, row in enumerate(introspection_module.get_table_description(cursor, table_name)):
att_name = row[0] att_name = row[0].lower()
comment_notes = [] # Holds Field notes, to be displayed in a Python comment. comment_notes = [] # Holds Field notes, to be displayed in a Python comment.
extra_params = {} # Holds Field parameters such as 'db_column'. extra_params = {} # Holds Field parameters such as 'db_column'.

View File

@ -1,5 +1,7 @@
from django.db.backends.oracle.base import quote_name from django.db.backends.oracle.base import quote_name
import re import re
import cx_Oracle
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)") foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
@ -84,19 +86,13 @@ WHERE allcols.column_name = primarycols.column_name (+) AND
indexes[row[0]] = {'primary_key': row[1], 'unique': row[2]} indexes[row[0]] = {'primary_key': row[1], 'unique': row[2]}
return indexes return indexes
# Maps type objects to Django Field types.
# Maps type codes to Django Field types.
DATA_TYPES_REVERSE = { DATA_TYPES_REVERSE = {
16: 'BooleanField', cx_Oracle.CLOB: 'TextField',
21: 'SmallIntegerField', cx_Oracle.DATETIME: 'DateTimeField',
23: 'IntegerField', cx_Oracle.FIXED_CHAR: 'CharField',
25: 'TextField', cx_Oracle.NCLOB: 'TextField',
869: 'IPAddressField', cx_Oracle.NUMBER: 'FloatField',
1043: 'CharField', cx_Oracle.STRING: 'TextField',
1082: 'DateField', cx_Oracle.TIMESTAMP: 'DateTimeField',
1083: 'TimeField',
1114: 'DateTimeField',
1184: 'DateTimeField',
1266: 'TimeField',
1700: 'FloatField',
} }