Author: phd
Date: 2005-10-20 16:11:21 +0000 (Thu, 20 Oct 2005)
New Revision: 1131
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py
Log:
Merged the patch from the revision 1130 from the trunk -
a patch by gary ng <li...@ga...> to guess more column types.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py 2005-10-20 16:06:43 UTC (rev 1130)
+++ SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py 2005-10-20 16:11:21 UTC (rev 1131)
@@ -245,7 +245,7 @@
def guessClass(self, t):
if t.count('int'):
return col.IntCol, {}
- elif t.count('varying'):
+ elif t.count('varying') or t.count('varchar'):
if '(' in t:
return col.StringCol, {'length': int(t[t.index('(')+1:-1])}
else: # varchar without length in Postgres means any length
@@ -253,10 +253,16 @@
elif t.startswith('character('):
return col.StringCol, {'length': int(t[t.index('(')+1:-1]),
'varchar': False}
+ elif t.count('float') or t.count('real') or t.count('double'):
+ return col.FloatCol, {}
elif t == 'text':
return col.StringCol, {}
+ elif t.startswith('timestamp'):
+ return col.DateTimeCol, {}
elif t.startswith('datetime'):
return col.DateTimeCol, {}
+ elif t.startswith('date'):
+ return col.DateCol, {}
elif t.startswith('bool'):
return col.BoolCol, {}
elif t.startswith('bytea'):
|