From 4fffc21c87cbdfc538fe2924f82bf1591823856d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 18 Apr 2007 22:54:40 +0000 Subject: - the "where" criterion of an update() and delete() now correlates embedded select() statements against the table being updated or deleted. this works the same as nested select() statement correlation, and can be disabled via the correlate=False flag on the embedded select(). --- test/sql/select.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/sql') diff --git a/test/sql/select.py b/test/sql/select.py index 91b293cbe..1d0a63e2f 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -828,10 +828,15 @@ class CRUDTest(SQLTest): u = update(table1, table1.c.name == 'jack', values = {table1.c.name : s}) self.runtest(u, "UPDATE mytable SET name=(SELECT myothertable.otherid, myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid) WHERE mytable.name = :mytable_name") - # test a correlated WHERE clause + # test a non-correlated WHERE clause s = select([table2.c.othername], table2.c.otherid == 7) u = update(table1, table1.c.name==s) self.runtest(u, "UPDATE mytable SET myid=:myid, name=:name, description=:description WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = :myothertable_otherid)") + + # test one that is actually correlated... + s = select([table2.c.othername], table2.c.otherid == table1.c.myid) + u = table1.update(table1.c.name==s) + self.runtest(u, "UPDATE mytable SET myid=:myid, name=:name, description=:description WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid)") def testdelete(self): self.runtest(delete(table1, table1.c.myid == 7), "DELETE FROM mytable WHERE mytable.myid = :mytable_myid") -- cgit v1.2.1