#5740: oracle inspectdb CharFields missing "max_length"
-----------------------------------------------------+----------------------
Reporter: Carl Karsten <[EMAIL PROTECTED]> | Owner: nobody
Status: new | Component:
django-admin.py inspectdb
Version: SVN | Resolution:
Keywords: oracle | Stage:
Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-----------------------------------------------------+----------------------
Changes (by Carl Karsten <[EMAIL PROTECTED]>):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
This may be a bug/issue with ceODBC's cursor.description(). or not. here
is some relevant code:
core/management/commands/inspectdb.py
for i, row in
enumerate(introspection_module.get_table_description(cursor, table_name)):
...
# Add max_length for all CharFields.
if field_type == 'CharField' and row[3]:
extra_params['max_length'] = row[3]
...
field_desc = '%s = models.%s' % (att_name, field_type)
if extra_params:
if not field_desc.endswith('('):
field_desc += ', '
field_desc += ', '.join(['%s=%r' % (k, v) for k, v in
extra_params.items()])
field_desc += ')'
if comment_notes:
field_desc += ' # ' + ' '.join(comment_notes)
yield ' %s' % field_desc
introspection.py
def get_table_description(cursor, table_name):
"Returns a description of the table, with the DB-API
cursor.description interface."
sql="SELECT * FROM %s " % quote_name(table_name)
cursor.execute(sql)
return cursor.description
--
Ticket URL: <http://code.djangoproject.com/ticket/5740#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---