[CalendarServer-changes] [8438] CalendarServer/branches/users/glyph/shared-pool-fixes

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 13 13:50:47 PST 2011


Revision: 8438
          http://trac.macosforge.org/projects/calendarserver/changeset/8438
Author:   glyph at apple.com
Date:     2011-12-13 13:50:47 -0800 (Tue, 13 Dec 2011)
Log Message:
-----------
test for the case where rowcount is not accurately updated

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/shared-pool-fixes/twext/enterprise/test/test_adbapi2.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/shared-pool-fixes/

Modified: CalendarServer/branches/users/glyph/shared-pool-fixes/twext/enterprise/test/test_adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/shared-pool-fixes/twext/enterprise/test/test_adbapi2.py	2011-12-13 21:50:44 UTC (rev 8437)
+++ CalendarServer/branches/users/glyph/shared-pool-fixes/twext/enterprise/test/test_adbapi2.py	2011-12-13 21:50:47 UTC (rev 8438)
@@ -192,8 +192,8 @@
             raise self.connection._executeFailQueue.pop(0)()
         self.allExecutions.append((sql, args))
         self.sql = sql
-        self.description = True
         factory = self.connection.parent
+        self.description = factory.hasResults
         if factory.hasResults and factory.shouldUpdateRowcount:
             self.rowcount = 1
         else:
@@ -1325,7 +1325,25 @@
         txn.commit()
 
 
+    def test_raiseOnZeroRowCountWithUnreliableRowCount(self):
+        """
+        As it turns out, some databases can't reliably tell you how many rows
+        they're going to fetch via the C{rowcount} attribute before the rows
+        have actually been fetched, so the C{raiseOnZeroRowCount} will I{not}
+        raise an exception if C{rowcount} is zero but C{description} and
+        C{fetchall} indicates the presence of some rows.
+        """
+        self.factory.hasResults = True
+        self.factory.shouldUpdateRowcount = False
+        txn = self.createTransaction()
+        r = self.resultOf(
+            txn.execSQL("some-rows", raiseOnZeroRowCount=RuntimeError)
+        )
+        [[[counter, echo]]] = r
+        self.assertEquals(echo, "some-rows")
 
+
+
 class IOPump(object):
     """
     Connect a client and a server.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111213/8ce64d59/attachment.html>


More information about the calendarserver-changes mailing list