dabo Commit
Revision 6855
Date: 2011-09-26 07:30:01 -0700 (Mon, 26 Sep 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6855

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

Log:
Added translation of param placeholders for all many-to-many methods.

Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2011-09-26 14:17:02 UTC (rev 6854)
+++ trunk/dabo/db/dCursorMixin.py       2011-09-26 14:30:01 UTC (rev 6855)
@@ -1194,8 +1194,8 @@
                for otherVal in listOfValues:
                        otherPK = self.lookupPKWithAdd(otherField, otherVal, 
otherTable)
                        aux = self.AuxCursor
-                       sql = "delete from %s where %s = ? and %s = ?" % 
(self._assocTable,
-                                       self._assocPKColThis, 
self._assocPKColOther)
+                       sql = self._qMarkToParamPlaceholder("delete from %s 
where %s = ? and %s = ?"
+                                       % (self._assocTable, 
self._assocPKColThis, self._assocPKColOther))
                        try:
                                dabo.dbActivityLog.info("mmDisssociateValues() 
SQL: %s, PARAMS: %s" % (
                                                
sql.decode(self.Encoding).replace("\n", " "), str((self._assocTable,
@@ -1218,7 +1218,8 @@
                M-M table.
                """
                aux = self.AuxCursor
-               sql = "delete from %s where %s = ?" % (self._assocTable, 
self._assocPKColThis)
+               sql = self._qMarkToParamPlaceholder("delete from %s where %s = 
?"
+                               % (self._assocTable, self._assocPKColThis))
                try:
                        dabo.dbActivityLog.info("mmDisssociateAll() SQL: %s" % (
                                        sql.decode(self.Encoding).replace("\n", 
" ")))
@@ -1251,8 +1252,8 @@
                thisPK = self.lookupPKWithAdd(thisField, thisVal, thisTable)
                otherPK = self.lookupPKWithAdd(otherField, otherVal, otherTable)
                aux = self.AuxCursor
-               sql = "select * from %s where %s = ? and %s = ?" % 
(self._assocTable,
-                               self._assocPKColThis, self._assocPKColOther)
+               sql = self._qMarkToParamPlaceholder("select * from %s where %s 
= ? and %s = ?"
+                               % (self._assocTable, self._assocPKColThis, 
self._assocPKColOther))
                try:
                        dabo.dbActivityLog.info("mmAddToBoth() SQL: %s, PARAMS: 
%s" % (
                                        sql.decode(self.Encoding).replace("\n", 
" "), str((thisPK, otherPK))))
@@ -1264,8 +1265,8 @@
                                dabo.dbActivityLog.info("mmAddToBoth() (failed 
to log SQL and PARAMS)")
                aux.execute(sql, (thisPK, otherPK))
                if not aux.RowCount:
-                       sql = "insert into %s (%s, %s) values (?, ?)" % 
(self._assocTable,
-                                       self._assocPKColThis, 
self._assocPKColOther)
+                       sql = self._qMarkToParamPlaceholder("insert into %s 
(%s, %s) values (?, ?)"
+                                       % (self._assocTable, 
self._assocPKColThis, self._assocPKColOther))
                        aux.execute(sql, (thisPK, otherPK))
 
 
@@ -1285,7 +1286,8 @@
                                self._assocPKColOther, self._mmOtherTable, 
self._mmOtherPKCol)
                aux.setJoinClause(join)
                aux.setFieldClause(fldNames)
-               aux.setWhereClause("%s.%s = ?" % (self._assocTable, 
self._assocPKColThis))
+               aux.setWhereClause(self._qMarkToParamPlaceholder("%s.%s = ?"
+                               % (self._assocTable, self._assocPKColThis)))
                params = (self.getPK(),)
                aux.requery(params)
                return aux.getDataSet()



_______________________________________________
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