Skip to content

Commit cef34b0

Browse files
authored
Merge pull request #7083 from kenjis/fix-BaseBuilder-resetQuery
fix: revert method name changed accidentally
2 parents 1f8a3f0 + 39f9e42 commit cef34b0

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

system/Database/BaseBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ protected function isLiteral(string $str): bool
32743274
*
32753275
* @return $this
32763276
*/
3277-
public function resetQueryAsData()
3277+
public function resetQuery()
32783278
{
32793279
$this->resetSelect();
32803280
$this->resetWrite();
@@ -3456,7 +3456,7 @@ protected function setBind(string $key, $value = null, bool $escape = true): str
34563456
*/
34573457
protected function cleanClone()
34583458
{
3459-
return (clone $this)->from([], true)->resetQueryAsData();
3459+
return (clone $this)->from([], true)->resetQuery();
34603460
}
34613461

34623462
/**

tests/system/Database/Builder/SelectTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,18 @@ public function testSelectSubquery()
309309

310310
$this->assertSame($expected, str_replace("\n", ' ', $builder->getCompiledSelect()));
311311
}
312+
313+
public function testSelectResetQuery()
314+
{
315+
$builder = new BaseBuilder('users', $this->db);
316+
$builder->select('name, role');
317+
318+
$builder->resetQuery();
319+
320+
$sql = $builder->getCompiledSelect();
321+
$this->assertSame(
322+
'SELECT * FROM "users"',
323+
str_replace("\n", ' ', $sql)
324+
);
325+
}
312326
}

0 commit comments

Comments
 (0)