dabo Commit
Revision 6851
Date: 2011-09-26 06:57:38 -0700 (Mon, 26 Sep 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6851
Changed:
U trunk/dabo/db/dCursorMixin.py
Log:
Added dbActivityLog output for the recently-added many-to-many methods.
Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2011-09-20 12:19:10 UTC (rev 6850)
+++ trunk/dabo/db/dCursorMixin.py 2011-09-26 13:57:38 UTC (rev 6851)
@@ -1139,6 +1139,15 @@
if tbl is None:
tbl = self.Table
sql = "select %s from %s where %s = ?" % (self.KeyField, tbl,
field)
+ try:
+ dabo.dbActivityLog.info("lookupPKWithAdd() SQL: %s,
PARAMS: %s" % (
+ sql.decode(self.Encoding).replace("\n",
" "), "(%s, )" % val))
+ except StandardError:
+ # A problem with writing to the log, most likely due to
encoding issues
+ try:
+ dabo.dbActivityLog.info("lookupPKWithAdd() SQL
(failed to log PARAMS): %r" % sql)
+ except StandardError:
+ dabo.dbActivityLog.info("lookupPKWithAdd()
(failed to log SQL and PARAMS)")
aux.execute(sql, (val,))
if aux.RowCount:
return aux.getPK()
@@ -1188,6 +1197,16 @@
sql = "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,
+ self._assocPKColThis,
self._assocPKColOther))))
+ except StandardError:
+ # A problem with writing to the log, most
likely due to encoding issues
+ try:
+
dabo.dbActivityLog.info("mmDisssociateValues() SQL (failed to log PARAMS): %r"
% sql)
+ except StandardError:
+
dabo.dbActivityLog.info("mmDisssociateValues() (failed to log SQL and PARAMS)")
+ try:
aux.execute(sql, (thisPK, otherPK))
except dException.NoRecordsException:
pass
@@ -1201,6 +1220,11 @@
aux = self.AuxCursor
sql = "delete from %s where %s = ?" % (self._assocTable,
self._assocPKColThis)
try:
+ dabo.dbActivityLog.info("mmDisssociateAll() SQL: %s" % (
+ sql.decode(self.Encoding).replace("\n",
" ")))
+ except StandardError:
+ dabo.dbActivityLog.info("mmDisssociateAll() (failed to
log SQL")
+ try:
aux.execute(sql, (self.getPK(),))
except dException.NoRecordsException:
pass
@@ -1229,6 +1253,15 @@
aux = self.AuxCursor
sql = "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))))
+ except StandardError:
+ # A problem with writing to the log, most likely due to
encoding issues
+ try:
+ dabo.dbActivityLog.info("mmAddToBoth() SQL
(failed to log PARAMS): %r" % sql)
+ except StandardError:
+ 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,
_______________________________________________
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]