dabo Commit
Revision 5510
Date: 2009-10-29 11:26:01 -0700 (Thu, 29 Oct 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5510

Changed:
U   trunk/dabo/db/dBackend.py
U   trunk/dabo/db/dCursorMixin.py
U   trunk/dabo/db/dbSQLite.py

Log:
This contains my patch for attempting to get BLOB updating and inserting 
working.
It contains some fixes from my posted patch, but still doesn't get BLOB support
working.


Diff:
Modified: trunk/dabo/db/dBackend.py
===================================================================
--- trunk/dabo/db/dBackend.py   2009-10-29 17:54:51 UTC (rev 5509)
+++ trunk/dabo/db/dBackend.py   2009-10-29 18:26:01 UTC (rev 5510)
@@ -72,7 +72,7 @@
                return cursorClass(self._connection)
 
 
-       def formatForQuery(self, val):
+       def formatForQuery(self, val, fieldType=None):
                if isinstance(val, (datetime.date, datetime.datetime)):
                        # Some databases have specific rules for formatting 
date values.
                        return self.formatDateTime(val)
@@ -82,6 +82,8 @@
                        return str(val)
                elif isinstance(val, dNoEscQuoteStr):
                        return val
+               elif fieldType == "L":
+                       return val
                elif val is None:
                        return self.formatNone()
                else:

Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2009-10-29 17:54:51 UTC (rev 5509)
+++ trunk/dabo/db/dCursorMixin.py       2009-10-29 18:26:01 UTC (rev 5510)
@@ -1355,7 +1355,8 @@
                                        # Append the field and its value.
                                        flds += ", " + 
self.BackendObject.encloseNames(kk, aq)
                                        # add value to expression
-                                       vals += ", %s" % 
(self.formatForQuery(vv[1]),)
+                                       fieldType = [ds[1] for ds in 
self.DataStructure if ds[0] == kk][0]
+                                       vals += ", %s" % 
(self.formatForQuery(vv[1], fieldType))
 
                                # Trim leading comma-space from the strings
                                flds = flds[2:]
@@ -1945,7 +1946,8 @@
                                continue
                        if ret:
                                ret += ", "
-                       ret += tblPrefix + bo.encloseNames(fld, aq) + " = " + 
self.formatForQuery(new_val)
+                       fieldType = [ds[1] for ds in self.DataStructure if 
ds[0] == fld][0]
+                       ret += tblPrefix + bo.encloseNames(fld, aq) + " = " + 
self.formatForQuery(new_val, fieldType)
                return ret
 
 
@@ -2010,11 +2012,11 @@
                return ret
 
 
-       def formatForQuery(self, val):
+       def formatForQuery(self, val, fieldType=None):
                """ Format any value for the backend """
                ret = val
                if self.BackendObject:
-                       ret = self.BackendObject.formatForQuery(val)
+                       ret = self.BackendObject.formatForQuery(val, fieldType)
                return ret
 
 

Modified: trunk/dabo/db/dbSQLite.py
===================================================================
--- trunk/dabo/db/dbSQLite.py   2009-10-29 17:54:51 UTC (rev 5509)
+++ trunk/dabo/db/dbSQLite.py   2009-10-29 18:26:01 UTC (rev 5510)
@@ -75,11 +75,11 @@
                return self._dictCursorClass
                
 
-       def formatForQuery(self, val):
+       def formatForQuery(self, val, fieldType=None):
                if isinstance(val, bool):
                        return str(int(val))
                else:
-                       return super(SQLite, self).formatForQuery(val)
+                       return super(SQLite, self).formatForQuery(val, 
fieldType)
 
 
        def escQuote(self, val):                        




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to