[CalendarServer-changes] [9593] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:54:36 PDT 2012


Revision: 9593
          http://trac.macosforge.org/projects/calendarserver/changeset/9593
Author:   glyph at apple.com
Date:     2012-08-11 01:54:35 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
a test for an Update statement with sqlite that returns results by querying twice

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py	2012-08-11 08:54:35 UTC (rev 9592)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py	2012-08-11 08:54:35 UTC (rev 9593)
@@ -1006,6 +1006,29 @@
         )
 
 
+    def test_updateReturningSQLite(self):
+        """
+        SQLite updates all its rows.
+        """
+        csql = CatchSQL()
+        stmt = Update({self.schema.FOO.BAR: 4321},
+                      Where=self.schema.FOO.BAZ == 1234,
+                      Return=self.schema.FOO.BAR)
+        csql.nextResult([["sample row id"]])
+        result = resultOf(stmt.on(csql))
+        self.assertEquals(
+            csql.execed,
+            [
+                ["select rowid from FOO where BAR = :1", [4321]],
+                ["update FOO set BAZ = :1 WHERE BAR = :2", [4321, 1234]],
+                ["select BAR from FOO where rowid = :1", ["sample row id"]],
+            ],
+        )
+        # Three statements were executed; make sure that the result returned was
+        # the result of executing the last one.
+        self.assertEquals(result, [2])
+
+
     def test_insertMismatch(self):
         """
         L{Insert} raises L{TableMismatch} if the columns specified aren't all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/ab9f20ca/attachment-0001.html>


More information about the calendarserver-changes mailing list