Skip to content

Commit 6e18021

Browse files
committed
Fix the way query are build
1 parent 54e1c94 commit 6e18021

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

SQL.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ function isUnary ($op) {
328328
return false;
329329
}
330330

331-
function query ($body, &$params, &$count) {
331+
function query ($body, &$params, &$count, $up_relation = null) {
332332
if ($params === null) { $params = []; }
333333
if ($count === null) { $count = 0; }
334334
$predicats = [];
@@ -345,7 +345,7 @@ function query ($body, &$params, &$count) {
345345
break;
346346
}
347347

348-
$predicats[] = '( ' . $this->query($value, $params, $count) . ' )';
348+
$predicats[] = '( ' . $this->query($value, $params, $count, $relation) . ' )';
349349
} else {
350350
if (!is_array($value)) {
351351
if ($this->isUnary($value)) {
@@ -441,6 +441,9 @@ function query ($body, &$params, &$count) {
441441
$predicats[] = $predicat;
442442
}
443443
}
444+
if ($up_relation) {
445+
$relation = $up_relation;
446+
}
444447
return join($relation, $predicats);
445448
}
446449

@@ -692,7 +695,7 @@ function search($body, $options) {
692695
$params = [];
693696
$count = 0;
694697

695-
$statement .= ' WHERE ' . $this->query($body, $params, $count);
698+
$statement .= ' WHERE ' . $this->query($body, $params, $count);
696699
if(! empty($options['sort'])) {
697700
$statement .= ' ' . $this->prepareSort($options['sort']);
698701
}

0 commit comments

Comments
 (0)