dabo Commit
Revision 2323
Date: 2006-10-09 17:51:21 -0700 (Mon, 09 Oct 2006)
Author: ed

Changed:
U   trunk/dabo/db/dbFirebird.py
U   trunk/dabo/db/dbMySQL.py
U   trunk/dabo/db/dbPostgreSQL.py
U   trunk/dabo/db/dbSQLite.py

Log:
Added a Dabo data type 'L' for blob fields ('B' is taken for 'Boolean'). 


Diff:
Modified: trunk/dabo/db/dbFirebird.py
===================================================================
--- trunk/dabo/db/dbFirebird.py 2006-10-09 23:06:58 UTC (rev 2322)
+++ trunk/dabo/db/dbFirebird.py 2006-10-10 00:51:21 UTC (rev 2323)
@@ -153,8 +153,9 @@
                                ft = "C"
                        elif ftype == "timestamp":
                                ft = "T"
+                       elif ftype == "blob":
+                               ft = "L"
                        else:
-                               # BLOB
                                ft = "?"
                        
                        if pkField is None:

Modified: trunk/dabo/db/dbMySQL.py
===================================================================
--- trunk/dabo/db/dbMySQL.py    2006-10-09 23:06:58 UTC (rev 2322)
+++ trunk/dabo/db/dbMySQL.py    2006-10-10 00:51:21 UTC (rev 2323)
@@ -133,6 +133,8 @@
                                ft = "C"
                        elif "text" in ft:
                                ft = "M"
+                       elif "blob" in ft:
+                               ft = "L"
                        elif "decimal" in ft or "float" in ft:
                                ft = "N"
                        elif "datetime" in ft:

Modified: trunk/dabo/db/dbPostgreSQL.py
===================================================================
--- trunk/dabo/db/dbPostgreSQL.py       2006-10-09 23:06:58 UTC (rev 2322)
+++ trunk/dabo/db/dbPostgreSQL.py       2006-10-10 00:51:21 UTC (rev 2323)
@@ -24,11 +24,7 @@
                        port = "5432"
                                
                DSN = "host=%s port=%s dbname=%s user=%s password=%s" % 
(connectInfo.Host,
-                       port,
-                       connectInfo.Database,
-                       connectInfo.User,
-                       connectInfo.revealPW())
-                       
+                       port, connectInfo.Database, connectInfo.User, 
connectInfo.revealPW())
                self._connection = dbapi.connect(DSN)
                return self._connection
 
@@ -91,18 +87,19 @@
                # jfcs 11/01/04 Below sucks but works with 7.3.x and 7.4.x 
(don't know anything
                # about 8.0.x) 
                # Ok get the 'field name', 'field type'
-               tempCursor.execute("Select c.oid,a.attname, t.typname \
-               from pg_class c inner join pg_attribute a \
-               on a.attrelid = c.oid inner join pg_type t on a.atttypid = 
t.oid \
-               where c.relname = '%s' and a.attnum > 0 " % tableName)
+               tempCursor.execute("""select c.oid,a.attname, t.typname 
+                               from pg_class c inner join pg_attribute a 
+                               on a.attrelid = c.oid inner join pg_type t on 
a.atttypid = t.oid 
+                               where c.relname = '%s' and a.attnum > 0 """ % 
tableName)
                rs = tempCursor.fetchall()
                myoid=rs[0][0]
                ## get the PK 
-               tempCursor.execute("SELECT c2.relname, i.indisprimary, 
i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid) \
-               FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, 
pg_catalog.pg_index i \
-               WHERE c.oid = %s AND c.oid = i.indrelid AND i.indexrelid = 
c2.oid \
-               AND i.indisprimary =TRUE \
-               ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname" % 
myoid)  
+               tempCursor.execute("""select c2.relname, i.indisprimary, 
i.indisunique, 
+                               pg_catalog.pg_get_indexdef(i.indexrelid) 
+                               FROM pg_catalog.pg_class c, pg_catalog.pg_class 
c2, pg_catalog.pg_index i 
+                               WHERE c.oid = %s AND c.oid = i.indrelid AND 
i.indexrelid = c2.oid 
+                               AND i.indisprimary =TRUE 
+                               ORDER BY i.indisprimary DESC, i.indisunique 
DESC, c2.relname""" % myoid)        
                rs2=tempCursor.fetchall()
                if rs2==[]:
                        thePKFieldName = None
@@ -117,20 +114,22 @@
                        pk = False
                        if thePKFieldName is not None:
                                pk = (name in thePKFieldName)
-                       if 'int' in fldType:
-                               fldType = 'I'
-                       elif 'char' in fldType :
-                               fldType = 'C'
-                       elif 'bool' in fldType :
-                               fldType = 'B'
-                       elif 'text' in fldType:
-                               fldType = 'M'
-                       elif 'numeric' in fldType:
-                               fldType = 'N'
-                       elif 'datetime' in fldType:
-                               fldType = 'T'
-                       elif 'date' in fldType:
-                               fldType = 'D'
+                       if "int" in fldType:
+                               fldType = "I"
+                       elif "char" in fldType :
+                               fldType = "C"
+                       elif "bool" in fldType :
+                               fldType = "B"
+                       elif "text" in fldType:
+                               fldType = "M"
+                       elif "numeric" in fldType:
+                               fldType = "N"
+                       elif "datetime" in fldType:
+                               fldType = "T"
+                       elif "date" in fldType:
+                               fldType = "D"
+                       elif "blob" in fldType:
+                               fldType = "L"
                        else:
                                fldType = "?"
                        fields.append((name.strip(), fldType, pk))

Modified: trunk/dabo/db/dbSQLite.py
===================================================================
--- trunk/dabo/db/dbSQLite.py   2006-10-09 23:06:58 UTC (rev 2322)
+++ trunk/dabo/db/dbSQLite.py   2006-10-10 00:51:21 UTC (rev 2323)
@@ -122,6 +122,8 @@
                                fldType = "I"
                        elif typ == "real":
                                fldType = "N"
+                       elif typ == "blob":
+                               fldType = "L"
                        else:
                                # SQLite treats everything else as text
                                fldType = "C"




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to