[SQL-CVS] r106 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2004-05-25 19:12:36
|
Author: iansparks Date: 2004-05-25 11:11:52 -0400 (Tue, 25 May 2004) New Revision: 106 Modified: trunk/SQLObject/sqlobject/col.py Log: Added support for firebird for Datetime and Date columns. Improved firebird support for enum columns. Modified: trunk/SQLObject/sqlobject/col.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/SQLObject/sqlobject/col.py 2004-04-25 18:02:09 UTC (rev 105) +++ trunk/SQLObject/sqlobject/col.py 2004-05-25 15:11:52 UTC (rev 106) @@ -221,8 +221,8 @@ # them differently for Enum columns. if not isinstance(self, SOEnumCol): return ' '.join([self.dbName, self._firebirdType()] + self._= extraSQL()) - else: - return ' '.join([self.dbName] + self._extraSQL() + [self._fi= rebirdType()]) + else: + return ' '.join([self.dbName] + [self._firebirdType()[0]] + = self._extraSQL() + [self._firebirdType()[1]]) =20 def __get__(self, obj, type=3DNone): if obj is None: @@ -472,7 +472,11 @@ return self._postgresType() =20 def _firebirdType(self): - return self._postgresType() + length =3D max(map(len, self.enumValues)) + enumValues =3D ', '.join([sqlbuilder.sqlrepr(v, 'firebird') for = v in self.enumValues]) + checkConstraint =3D "CHECK (%s in (%s))" % (self.dbName, enumVal= ues) + #NB. Return a tuple, not a string here + return "VARCHAR(%i)" % (length), checkConstraint =20 class EnumCol(Col): baseClass =3D SOEnumCol @@ -493,7 +497,10 @@ =20 def _sqliteType(self): return 'TIMESTAMP' - + + def _firebirdType(self): + return 'TIMESTAMP' + class DateTimeCol(Col): baseClass =3D SODateTimeCol =20 @@ -510,6 +517,9 @@ =20 def _sybaseType(self): return self._postgresType() + + def _firebirdType(self): + return 'DATE' =20 class DateCol(Col): baseClass =3D SODateCol |