mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-30739 add one test to confirm the solution is cross-db
This commit is contained in:
parent
ceec817f95
commit
fbb829b82d
1 changed files with 11 additions and 0 deletions
|
@ -919,6 +919,17 @@ class dml_test extends UnitTestCase {
|
||||||
$this->assertTrue($DB->execute($sql, array('3')));
|
$this->assertTrue($DB->execute($sql, array('3')));
|
||||||
$this->assertEqual($DB->count_records($tablename1, array('course' => 6)), 2);
|
$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
|
// insert from one into second table
|
||||||
$sql = "INSERT INTO {{$tablename2}} (course)
|
$sql = "INSERT INTO {{$tablename2}} (course)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue