Author: phd
Date: 2007-07-16 06:08:08 -0600 (Mon, 16 Jul 2007)
New Revision: 2755
Modified:
SQLObject/branches/0.9/docs/News.txt
SQLObject/branches/0.9/sqlobject/firebird/firebirdconnection.py
Log:
Applied the patch N 1745239: Fixed a bug with default field values for columns for firebird connection.
Modified: SQLObject/branches/0.9/docs/News.txt
===================================================================
--- SQLObject/branches/0.9/docs/News.txt 2007-07-16 12:06:41 UTC (rev 2754)
+++ SQLObject/branches/0.9/docs/News.txt 2007-07-16 12:08:08 UTC (rev 2755)
@@ -232,6 +232,9 @@
SQLObject 0.7.8
===============
+Bug Fixes
+---------
+
* Replaced calls to style.dbColumnToPythonAttr() in joins.py by name/dbName
lookup in case the user named columns differently using dbName.
@@ -242,6 +245,8 @@
* Minor fix in FirebirdConnection.fromDatabase.
+* Fixed a bug with default field values for columns for firebird connection.
+
SQLObject 0.7.7
===============
Modified: SQLObject/branches/0.9/sqlobject/firebird/firebirdconnection.py
===================================================================
--- SQLObject/branches/0.9/sqlobject/firebird/firebirdconnection.py 2007-07-16 12:06:41 UTC (rev 2754)
+++ SQLObject/branches/0.9/sqlobject/firebird/firebirdconnection.py 2007-07-16 12:08:08 UTC (rev 2755)
@@ -172,26 +172,27 @@
"""
fieldqry = """\
- SELECT RDB$RELATION_FIELDS.RDB$FIELD_NAME as field,
- RDB$TYPES.RDB$TYPE_NAME as t,
- RDB$FIELDS.RDB$FIELD_LENGTH as flength,
- RDB$FIELDS.RDB$FIELD_SCALE as fscale,
- RDB$RELATION_FIELDS.RDB$NULL_FLAG as nullAllowed,
- RDB$RELATION_FIELDS.RDB$DEFAULT_VALUE as thedefault,
- RDB$FIELDS.RDB$FIELD_SUB_TYPE as blobtype
- FROM RDB$RELATION_FIELDS
- INNER JOIN RDB$FIELDS ON
- (RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME)
- INNER JOIN RDB$TYPES ON (RDB$FIELDS.RDB$FIELD_TYPE =
- RDB$TYPES.RDB$TYPE)
- WHERE
- (RDB$RELATION_FIELDS.RDB$RELATION_NAME = '%s')
- AND (RDB$TYPES.RDB$FIELD_NAME = 'RDB$FIELD_TYPE')"""
+ SELECT rf.RDB$FIELD_NAME as field,
+ t.RDB$TYPE_NAME as t,
+ f.RDB$FIELD_LENGTH as flength,
+ f.RDB$FIELD_SCALE as fscale,
+ rf.RDB$NULL_FLAG as nullAllowed,
+ coalesce(rf.RDB$DEFAULT_SOURCE, f.rdb$default_source) as thedefault,
+ f.RDB$FIELD_SUB_TYPE as blobtype
+ FROM RDB$RELATION_FIELDS rf
+ INNER JOIN RDB$FIELDS f ON rf.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME
+ INNER JOIN RDB$TYPES t ON f.RDB$FIELD_TYPE = t.RDB$TYPE
+ WHERE rf.RDB$RELATION_NAME = '%s'
+ AND t.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'"""
colData = self.queryAll(fieldqry % tableName.upper())
results = []
for field, t, flength, fscale, nullAllowed, thedefault, blobType in colData:
- field = field.strip()
+ field = field.strip().lower()
+ if thedefault:
+ thedefault = thedefault.split(' ')[1]
+ if thedefault.startswith("'") and thedefault.endswith("'"):
+ thedefault = thedefault[1:-1]
idName = str(soClass.sqlmeta.idName or 'id').upper()
if field.upper() == idName:
continue
|