Skip to content

Commit 5ba0766

Browse files
committed
fix(db): Fix Oracle JSON handling
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 2648401 commit 5ba0766

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,32 @@ protected function prepareColumn($column, $type) {
2727
return parent::prepareColumn($column, $type);
2828
}
2929

30+
/**
31+
* @inheritdoc
32+
*/
33+
public function eq($x, $y, $type = null): string {
34+
if ($type === IQueryBuilder::PARAM_JSON) {
35+
$x = $this->prepareColumn($x, $type);
36+
$y = $this->prepareColumn($y, $type);
37+
return new QueryFunction('JSON_EQUAL(' . $x . ',' . $y . ')');
38+
}
39+
40+
return parent::eq($x, $y, $type);
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function neq($x, $y, $type = null): string {
47+
if ($type === IQueryBuilder::PARAM_JSON) {
48+
$x = $this->prepareColumn($x, $type);
49+
$y = $this->prepareColumn($y, $type);
50+
return new QueryFunction('NOT JSON_EQUAL(' . $x . ',' . $y . ')');
51+
}
52+
53+
return parent::neq($x, $y, $type);
54+
}
55+
3056
/**
3157
* @inheritdoc
3258
*/

0 commit comments

Comments
 (0)