#41 Fix for styles.py for uppercase column names

closed-rejected
nobody
None
5
2006-02-09
2006-01-27
No

If a database column name is in all uppercase, with
words separated by undscores (as is the case with
column names when fetched from the data dictionary in
Firebird), the conversion from database column name to
Python attribute name and back does not work correctly,
as shown below. This is due to the fact that the style
expects a lowercase column name, which will not be the
case with Firebird connections.

Example:

>>>
>>> from sqlobject import styles
>>> style = styles.DefaultStyle()
>>>
style.pythonAttrToDBColumn(style.dbColumnToPythonAttr('START_DATE'))
'startdat_e'
>>>
style.pythonAttrToDBColumn(style.dbColumnToPythonAttr('start_date'))
'start_date'

The attached patch simply converts the column name to
lowercase before performing the conversion on it in
underToMixed.

Discussion

  • Gabriel Reid

    Gabriel Reid - 2006-01-27

    Patch to fix conversion of uppercase column names

     
    Attachments
  • Oleg Broytman

    Oleg Broytman - 2006-01-31
    • status: open --> open-rejected
     
  • Oleg Broytman

    Oleg Broytman - 2006-01-31

    Logged In: YES
    user_id=4799

    The patch is too simple, it breaks many things. For example,
    test_SQLMultipleJoin.py:

    return self.FieldClass(self.tableName,
    E
    self.soClass.sqlmeta.columns[attr].dbName,
    > KeyError: 'raceid'

    [sqlobject/sqlbuilder.py:365]

    test_SingleJoin.py:

    return self.FieldClass(self.tableName,
    E
    self.soClass.sqlmeta.columns[attr].dbName,
    > KeyError: 'personid'

     
  • Oleg Broytman

    Oleg Broytman - 2006-02-09
    • status: open-rejected --> closed-rejected
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks