Skip to content

Commit ca018d3

Browse files
author
Tetsuro Yoshikawa
committed
test: add test case for sub query.
1 parent 14e3dfb commit ca018d3

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

tests/system/Database/Live/WhereTest.php

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,21 @@ public function testSubQuery()
128128
->where('name', 'Developer')
129129
->getCompiledSelect();
130130

131-
$jobs = $this->db->table('job')
132-
->where('id not in (' . $subQuery . ')', null, false)
133-
->get()
134-
->getResult();
131+
if ($this->db->DBDriver === 'OCI8')
132+
{
133+
$jobs = $this->db->table('job')
134+
->where('"id" not in (' . $subQuery . ')', null, false)
135+
->orderBy('id')
136+
->get()
137+
->getResult();
138+
}
139+
else
140+
{
141+
$jobs = $this->db->table('job')
142+
->where('id not in (' . $subQuery . ')', null, false)
143+
->get()
144+
->getResult();
145+
}
135146

136147
$this->assertCount(3, $jobs);
137148
$this->assertEquals('Politician', $jobs[0]->name);
@@ -148,10 +159,20 @@ public function testSubQueryAnotherType()
148159
->where('name', 'Developer')
149160
->getCompiledSelect();
150161

151-
$jobs = $this->db->table('job')
152-
->where('id = (' . $subQuery . ')', null, false)
153-
->get()
154-
->getResult();
162+
if ($this->db->DBDriver === 'OCI8')
163+
{
164+
$jobs = $this->db->table('job')
165+
->where('"id" = (' . $subQuery . ')', null, false)
166+
->get()
167+
->getResult();
168+
}
169+
else
170+
{
171+
$jobs = $this->db->table('job')
172+
->where('id = (' . $subQuery . ')', null, false)
173+
->get()
174+
->getResult();
175+
}
155176

156177
$this->assertCount(1, $jobs);
157178
$this->assertEquals('Developer', $jobs[0]->name);

0 commit comments

Comments
 (0)