Skip to content

Commit

Permalink
Removed $escape = false; again
Browse files Browse the repository at this point in the history
Added another test where this makes a difference.
  • Loading branch information
sclubricants committed Jan 18, 2023
1 parent a79f8b3 commit 8d0e216
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ protected function whereHaving(string $qbKey, $key, $value = null, string $type
} else {
$keyValue = [(string) $key => $value];
}
$escape = false;
} elseif (! is_array($key)) {
$keyValue = [$key => $value];
} else {
Expand Down
15 changes: 15 additions & 0 deletions tests/system/Database/Builder/WhereTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ public function testWhereValueRawSql()
$this->assertSame($expected, $sql);
}

public function testWhereKeyOnlyRawSql()
{
$sql = $this->db->table('auth_bearer')
->select('*')
->where(new RawSql('DATE_ADD(NOW(), INTERVAL 2 HOUR)'), '2023-01-01')
->getCompiledSelect(true);

$expected = <<<'SQL'
SELECT *
FROM "auth_bearer"
WHERE DATE_ADD(NOW(), INTERVAL 2 HOUR) = '2023-01-01'
SQL;
$this->assertSame($expected, $sql);
}

public function testWhereKeyAndValueRawSql()
{
$sql = $this->db->table('auth_bearer')
Expand Down

0 comments on commit 8d0e216

Please sign in to comment.