From 5cff28cfa1dbd661b49468066570bb44f7cb441c Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 15 Dec 2011 13:07:18 +0100 Subject: [PATCH] MDL-30739 add one test to confirm the solution is cross-db --- lib/dml/simpletest/testdml.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/dml/simpletest/testdml.php b/lib/dml/simpletest/testdml.php index fce8f4044f5..f7c2152b603 100644 --- a/lib/dml/simpletest/testdml.php +++ b/lib/dml/simpletest/testdml.php @@ -919,6 +919,17 @@ class dml_test extends UnitTestCase { $this->assertTrue($DB->execute($sql, array('3'))); $this->assertEqual($DB->count_records($tablename1, array('course' => 6)), 2); + // update records with subquery condition + // confirm that the option not using table aliases is cross-db + $sql = "UPDATE {{$tablename1}} + SET course = 0 + WHERE NOT EXISTS ( + SELECT course + FROM {{$tablename2}} tbl2 + WHERE tbl2.course = {{$tablename1}}.course + AND 1 = 0)"; // Really we don't update anything, but verify the syntax is allowed + $this->assertTrue($DB->execute($sql)); + // insert from one into second table $sql = "INSERT INTO {{$tablename2}} (course)