Commit 54c539dd by Qiang Xue

Fixed buildInCondition bug.

parent 137d4728
...@@ -592,21 +592,19 @@ class QueryBuilder extends \yii\base\Object ...@@ -592,21 +592,19 @@ class QueryBuilder extends \yii\base\Object
return $operator === 'IN' ? '0=1' : ''; return $operator === 'IN' ? '0=1' : '';
} }
if (is_array($column)) { if (count($column) > 1) {
if (count($column) > 1) { return $this->buildCompositeInCondition($operator, $column, $values);
return $this->buildCompositeInCondition($operator, $column, $values); } elseif (is_array($column)) {
$column = reset($column);
}
foreach ($values as $i => $value) {
if (is_array($value)) {
$value = isset($value[$column]) ? $value[$column] : null;
}
if ($value === null) {
$values[$i] = 'NULL';
} else { } else {
$column = reset($column); $values[$i] = is_string($value) ? $this->db->quoteValue($value) : (string)$value;
foreach ($values as $i => $value) {
if (is_array($value)) {
$value = isset($value[$column]) ? $value[$column] : null;
}
if ($value === null) {
$values[$i] = 'NULL';
} else {
$values[$i] = is_string($value) ? $this->db->quoteValue($value) : (string)$value;
}
}
} }
} }
if (strpos($column, '(') === false) { if (strpos($column, '(') === false) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment