From: <sub...@co...> - 2004-06-14 12:36:50
|
Author: ahmedmo Date: 2004-06-14 04:34:16 -0400 (Mon, 14 Jun 2004) New Revision: 140 Modified: trunk/SQLObject/col.py Log: Modified: trunk/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/col.py 2004-06-14 08:07:50 UTC (rev 139) +++ trunk/SQLObject/col.py 2004-06-14 08:34:16 UTC (rev 140) @@ -202,10 +202,10 @@ =20 def _firebirdType(self): return self._sqlType() - =20 + =20 def _maxdbType(self): - return self._sqlType() =20 - =20 + return self._sqlType() + def mysqlCreateSQL(self): return ' '.join([self.dbName, self._mysqlType()] + self._extraSQ= L()) =20 @@ -226,9 +226,9 @@ return ' '.join([self.dbName, self._firebirdType()] + self._= extraSQL()) else: return ' '.join([self.dbName] + [self._firebirdType()[0]] + = self._extraSQL() + [self._firebirdType()[1]]) - =20 +=09 def maxdbCreateSQL(self): - return ' '.join([self.dbName, self._maxdbType()] + self._extraSQ= L()) + return ' '.join([self.dbName, self._maxdbType()] + self._extraSQL= ()) =20 def __get__(self, obj, type=3DNone): if obj is None: @@ -311,10 +311,10 @@ return self._sqlType() =20 def _maxdbType(self): - if not self.length: - return 'LONG ASCII' - else: - return self._sqlType() + if not self.length: + return 'LONG ASCII' + else: + return self._sqlType() =20 class StringCol(Col): baseClass =3D SOStringCol @@ -328,9 +328,6 @@ =20 def _sqlType(self): return 'INT' - =20 - def _maxdbType(self): - return 'INT' =20 class IntCol(Col): baseClass =3D SOIntCol @@ -369,9 +366,9 @@ =20 def _firebirdType(self): return 'INT' - =20 - def _maxdbType(self): - return "BOOLEAN" + =20 + def _maxdbType(self): + return "BOOLEAN" =20 class BoolCol(Col): baseClass =3D SOBoolCol @@ -460,16 +457,16 @@ return sql =20 def maxdbCreateSQL(self): - from main import findClass - other =3D findClass(self.foreignKey) - fidName =3D self.dbName - #I assume that foreign key name is identical to the id of the referenc= e table =09 - sql =3D ' '.join([fidName, self._maxdbType()]) - tName =3D other._table - idName =3D other._idName - sql=3Dsql + ',' + '\n'=20 - sql=3Dsql + 'FOREIGN KEY (%s) REFERENCES %s(%s)'%(fidName,tName,idName= ) - return sql + from main import findClass + other =3D findClass(self.foreignKey) + fidName =3D self.dbName + #I assume that foreign key name is identical to the id of the referen= ce table =09 + sql =3D ' '.join([fidName, self._maxdbType()]) + tName =3D other._table + idName =3D other._idName + sql=3Dsql + ',' + '\n'=20 + sql=3Dsql + 'FOREIGN KEY (%s) REFERENCES %s(%s)'%(fidName,tName,idNam= e) + return sql =20 class ForeignKey(KeyCol): =20 @@ -510,10 +507,9 @@ checkConstraint =3D "CHECK (%s in (%s))" % (self.dbName, enumVal= ues) #NB. Return a tuple, not a string here return "VARCHAR(%i)" % (length), checkConstraint - =20 +=20 def _maxdbType(self): raise "Enum type is not supported" - =20 =20 class EnumCol(Col): baseClass =3D SOEnumCol @@ -537,9 +533,9 @@ =20 def _firebirdType(self): return 'TIMESTAMP' - =20 - def _maxdbType(self): - return 'TIMESTAMP' + =20 + def _maxdbType(self): + return 'TIMESTAMP' =20 class DateTimeCol(Col): baseClass =3D SODateTimeCol |