[CalendarServer-changes] [9609] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:54:49 PDT 2012
Revision: 9609
http://trac.macosforge.org/projects/calendarserver/changeset/9609
Author: glyph at apple.com
Date: 2012-08-11 01:54:49 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
another, similar test.
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:48 UTC (rev 9608)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py 2012-08-11 08:54:49 UTC (rev 9609)
@@ -1057,6 +1057,37 @@
)
+ def test_updateReturningMultipleValuesSQLite(self):
+ """
+ When SQLite updates multiple values, it must embed the row ID of each
+ subsequent value into its second 'where' clause, as there is no way to
+ pass a list of values to a single statement..
+ """
+ csql = CatchSQL()
+ stmt = Update({self.schema.FOO.BAR: 4321},
+ Where=self.schema.FOO.BAZ == 1234,
+ Return=self.schema.FOO.BAR)
+ csql.nextResult([["one row id"], ["and another"], ["and one more"]])
+ result = resultOf(stmt.on(csql))
+ # Three statements were executed; make sure that the result returned was
+ # the result of executing the 3rd (and final) one.
+ self.assertResultList(result, 3)
+ # Check that they were the right statements.
+ self.assertEqual(len(csql.execed), 3)
+ self.assertEqual(
+ csql.execed[0],
+ ["select rowid from FOO where BAZ = :1", [1234]]
+ )
+ self.assertEqual(
+ csql.execed[1],
+ ["update FOO set BAR = :1 where BAZ = :2", [4321, 1234]]
+ )
+ self.assertEqual(csql.execed[2],
+ ["select BAR from FOO where rowid = :1 or rowid = :2 or rowid = :3",
+ ["one row id", "and another", "and one more"]]
+ )
+
+
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/d88e8338/attachment.html>
More information about the calendarserver-changes
mailing list