dabo Commit
Revision 5527
Date: 2009-11-14 16:15:00 -0800 (Sat, 14 Nov 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5527

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

Log:
Fixed the error reported by Miguel Lopes when updating multiple fields. Took 
the opportunity to clean up some related code.


Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2009-11-14 20:39:40 UTC (rev 5526)
+++ trunk/dabo/db/dCursorMixin.py       2009-11-15 00:15:00 UTC (rev 5527)
@@ -1382,7 +1382,6 @@
                                updClause, params = self.makeUpdClause(diff)
                                sql = "update %s set %s where %s" % 
(self.BackendObject.encloseNames(self.Table, aq),
                                                updClause, pkWhere)
-
                        #run the update
                        aux = self.AuxCursor
                        res = aux.execute(sql, params)
@@ -1944,7 +1943,7 @@
                containing the sql portion as the first element, and the 
parameters for the 
                values as the second.
                """
-               retSql = ""
+               retSql = []
                retParams = []
                bo = self.BackendObject
                aq = self.AutoQuoteNames
@@ -1955,15 +1954,13 @@
                        # Skip the fields that are not to be updated.
                        if fld in nonup:
                                continue
-                       if ret:
-                               ret += ", "
                        fieldType = [ds[1] for ds in self.DataStructure if 
ds[0] == fld][0]
                        nms = bo.encloseNames(fld, aq)
-                       retSql = "%s%s%s = %s" % (retSql, tblPrefix, nms, 
self.BackendObject.paramPlaceholder)
-                       print "CURS FT", fieldType
-                       thisVal =self.formatForQuery(new_val, fieldType)
-                       retParams.append(thisVal)
-               return (retSql, tuple(retParams))
+                       retSql.append("%s%s = %s" % (tblPrefix, nms, 
+                                       self.BackendObject.paramPlaceholder))
+                       #thisVal =self.formatForQuery(new_val, fieldType)
+                       retParams.append(new_val)
+               return (", ".join(retSql), tuple(retParams))
 
 
        def processFields(self, txt):



_______________________________________________
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