[CalendarServer-changes] [14597] twext/trunk/twext/enterprise
source_changes at macosforge.org
source_changes at macosforge.org
Sun Mar 15 20:01:36 PDT 2015
Revision: 14597
http://trac.calendarserver.org//changeset/14597
Author: cdaboo at apple.com
Date: 2015-03-15 20:01:36 -0700 (Sun, 15 Mar 2015)
Log Message:
-----------
Fixes to support Oracle DB unit testing.
Modified Paths:
--------------
twext/trunk/twext/enterprise/adbapi2.py
twext/trunk/twext/enterprise/dal/model.py
twext/trunk/twext/enterprise/dal/syntax.py
Modified: twext/trunk/twext/enterprise/adbapi2.py
===================================================================
--- twext/trunk/twext/enterprise/adbapi2.py 2015-03-16 00:30:29 UTC (rev 14596)
+++ twext/trunk/twext/enterprise/adbapi2.py 2015-03-16 03:01:36 UTC (rev 14597)
@@ -302,7 +302,13 @@
else:
if raiseOnZeroRowCount is not None and self._cursor.rowcount == 0:
raise raiseOnZeroRowCount()
- return None
+ # Oracle with a return into clause returns an empty set or rows, but
+ # we then have to insert the special bind variables for the return into.
+ # Thus we need to know whether there was any rowcount from the actual query.
+ # What we do is always insert a set of empty rows as the result if the
+ # rowcount is non-zero. Then we can detect whether the bind variables
+ # need to be added into the result set.
+ return [[]] * self._cursor.rowcount if self._cursor.rowcount else None
def execSQL(self, *args, **kw):
Modified: twext/trunk/twext/enterprise/dal/model.py
===================================================================
--- twext/trunk/twext/enterprise/dal/model.py 2015-03-16 00:30:29 UTC (rev 14596)
+++ twext/trunk/twext/enterprise/dal/model.py 2015-03-16 03:01:36 UTC (rev 14597)
@@ -54,7 +54,7 @@
def __init__(self, name, length):
_checkstr(name)
self.name = name
- self.length = length
+ self.length = length if length else 0
def __eq__(self, other):
Modified: twext/trunk/twext/enterprise/dal/syntax.py
===================================================================
--- twext/trunk/twext/enterprise/dal/syntax.py 2015-03-16 00:30:29 UTC (rev 14596)
+++ twext/trunk/twext/enterprise/dal/syntax.py 2015-03-16 03:01:36 UTC (rev 14597)
@@ -1655,9 +1655,13 @@
queryGenerator.dialect == ORACLE_DIALECT and
self.Return is not None
):
- def processIt(shouldBeNone):
- result = [[v.value for _ignore_k, v in outvars]]
- return result
+ def processIt(emptyListResult):
+ # See comment in L{adbapi2._ConnectedTxn._reallyExecSQL}. If the
+ # result is L{None} then also return L{None}. If the result is a
+ # L{list} of empty L{list} then there are return into rows to return.
+ if emptyListResult:
+ emptyListResult = [[v.value for _ignore_k, v in outvars]]
+ return emptyListResult
return result.addCallback(processIt)
else:
return result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150315/e8d73ed4/attachment.html>
More information about the calendarserver-changes
mailing list