Skip to content

Commit 864d366

Browse files
committed
Excluding a condition from a query string.
1 parent 5eb8c82 commit 864d366

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

system/Database/BaseBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,16 +865,18 @@ protected function _whereIn(?string $key = null, $values = null, bool $not = fal
865865
$not = ($not) ? ' NOT' : '';
866866

867867
if ($this->isSubquery($values)) {
868-
$ok = $this->buildSubquery($values);
868+
$whereIn = $this->buildSubquery($values, true);
869+
$escape = false;
869870
} else {
870871
$whereIn = array_values($values);
871-
$ok = $this->setBind($ok, $whereIn, $escape);
872872
}
873873

874+
$ok = $this->setBind($ok, $whereIn, $escape);
875+
874876
$prefix = empty($this->{$clause}) ? $this->groupGetType('') : $this->groupGetType($type);
875877

876878
$whereIn = [
877-
'condition' => $prefix . $key . $not . ($this->isSubquery($values) ? " IN ({$ok})" : " IN :{$ok}:"),
879+
'condition' => "{$prefix}{$key}{$not} IN :{$ok}:",
878880
'escape' => false,
879881
];
880882

0 commit comments

Comments
 (0)