Changeset 3328

Show
Ignore:
Timestamp:
08/23/07 13:56:15 (1 year ago)
Author:
ed
Message:

This fixes the problem introduced by using AuxCursors? instead of plain cursors. With Firebird, plain cursors return tuples, whereas AuxCursors? return dicts.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/db/dbFirebird.py

    r3325 r3328  
    103103        cursor.execute("select rdb$relation_name from rdb$relations " 
    104104            "%s order by rdb$relation_name" % whereClause) 
    105         rs = tempCursor.getDataSet() 
     105        rs = cursor.getDataSet() 
    106106        tables = [] 
    107107        for record in rs: 
    108             tables.append(record[0].strip()) 
     108            tables.append(record["rdb$relation_name"].strip()) 
    109109        return tuple(tables) 
    110110         
     
    112112    def getTableRecordCount(self, tableName, cursor): 
    113113        cursor.execute("select count(*) as ncount from %s where 1=1" % tableName) 
    114         return tempCursor.getDataSet()[0][0] 
     114        return cursor.getDataSet()[0][0] 
    115115 
    116116 
     
    132132        rs = cursor.getDataSet(rows=1) 
    133133        try: 
    134             pkField = rs[0].strip() 
     134            pkField = rs[0]["column_name"].strip() 
    135135        except: 
    136136            pkField = None 
     
    150150 AND a.RDB$RELATION_NAME = '%s' 
    151151 ORDER BY b.RDB$FIELD_ID """ % tableName.upper() 
    152   
     152 
    153153        cursor.execute(sql) 
    154154        rs = cursor.getDataSet() 
    155155        fields = [] 
    156156        for r in rs: 
    157             name = r[0].strip() 
    158  
    159             ftype = r[1].strip().lower() 
     157            name = r["rdb$field_name"].strip() 
     158            ftype = r["rdb$type_name"].strip().lower() 
    160159            if ftype == "text": 
    161160                ft = "C" 
    162161            elif ftype == "varying": 
    163                 if r[2] > 64: 
     162                if r["rdb$field_length"] > 64: 
    164163                    ft = "M" 
    165164                else: 
     
    167166            elif ftype in ("long", "short", "int64", "double"): 
    168167                # Can be either integers or float types, depending on column 3 
    169                 if r[3] == 0: 
     168                if r["rdb$field_scale"] == 0: 
    170169                    # integer 
    171170                    ft = "I"