I found that StringCol ignores the sqlType parameter, because it gets
lost in StringCol's own logic for determining the column type. This
caused me problems because I have a table with a BLOB field which needs
to be more than 64k (the limit of TEXT on MySQL).
This patch (against svn head) will always use customSQLType if it is
defined.
This doesn't work for Firebird databases, because it defines its own
type for unbounded strings. Perhaps a better solution would be to allow
the user to pass a dictionary of db-specific types?
sqlobject/col.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
diff -puN sqlobject/col.py~stringcol-sqltype sqlobject/col.py
--- SQLObject/sqlobject/col.py~stringcol-sqltype 2004-07-07 11:46:25.927588481 -0700
+++ SQLObject-jeremy/sqlobject/col.py 2004-07-07 11:47:46.660114103 -0700
@@ -297,7 +297,9 @@ class SOStringCol(SOCol):
return constraints
def _sqlType(self):
- if not self.length:
+ if self.customSQLType is not None:
+ return self.customSQLType
+ elif not self.length:
return 'TEXT'
elif self.varchar:
return 'VARCHAR(%i)' % self.length
_
J
|