dabo Commit
Revision 3660
Date: 2007-11-11 13:45:09 -0800 (Sun, 11 Nov 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3660
Changed:
U trunk/dabo/biz/dBizobj.py
U trunk/dabo/db/dCursorMixin.py
Log:
Modifed the executeSafe() method to accept an optional 'params' parameter.
Changed the logic so that the temp cursor is returned. Formerly, only the row
count of the statment was returned, which is fine for updates, but useless for
queries where you want access to the data.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2007-11-11 21:26:01 UTC (rev 3659)
+++ trunk/dabo/biz/dBizobj.py 2007-11-11 21:45:09 UTC (rev 3660)
@@ -561,20 +561,20 @@
raise StandardError, e
- def execute(self, sql):
+ def execute(self, sql, params=None):
"""Execute the sql on the cursor. Dangerous. Use executeSafe
instead."""
self._syncWithCursors()
- return self._CurrentCursor.execute(sql)
+ return self._CurrentCursor.execute(sql, params)
- def executeSafe(self, sql):
+ def executeSafe(self, sql, params=None):
"""Execute the passed SQL using an auxiliary cursor.
This is considered 'safe', because it won't harm the contents
of the
main cursor.
"""
self._syncWithCursors()
- return self._CurrentCursor.executeSafe(sql)
+ return self._CurrentCursor.executeSafe(sql, params)
def getChangedRows(self, includeNewUnchanged=False):
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2007-11-11 21:26:01 UTC (rev 3659)
+++ trunk/dabo/db/dCursorMixin.py 2007-11-11 21:45:09 UTC (rev 3660)
@@ -355,16 +355,17 @@
return res
- def executeSafe(self, sql):
+ def executeSafe(self, sql, params=None):
"""Execute the passed SQL using an auxiliary cursor.
This is considered 'safe', because it won't harm the contents
- of the main cursor.
+ of the main cursor. Returns the temp cursor.
"""
ac = self.AuxCursor
self._syncAuxProperties()
- return ac.execute(sql)
+ ac.execute(sql, params)
+ return ac
+
-
def _newStructure(self, sql):
"""Attempts to parse the SQL to determine if the fields being
selected will require
a new call to set the structure. Non-select statements likewise
will return False.
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]