Skip to content

Commit

Permalink
修复:IN操作
Browse files Browse the repository at this point in the history
  • Loading branch information
dxkite committed Jul 17, 2019
1 parent ff61668 commit 78e8649
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions suda/src/database/statement/PrepareTrait.php
Expand Up @@ -63,7 +63,7 @@ protected function prepareWhere(array $where)
private function getQueryForArray(string $name, $value)
{
if ($value instanceof IteratorAggregate) {
return $this->prepareIn($name, $value);
return $this->prepareIn($name, 'IN', $value);
} elseif (is_array($value)) {
list($op, $val) = $value;
$op = trim($op);
Expand All @@ -90,7 +90,7 @@ private function createQueryOperation(string $name, string $operation, $value, s
return new Query("`{$name}` {$operation} (".$value->getQuery().')', $value->getBinder());
}
if ($value instanceof IteratorAggregate || is_array($value)) {
return $this->prepareIn($name, $value);
return $this->prepareIn($name, $operation, $value);
}
if (strlen($indexName) === 0) {
$indexName = Binder::index($name);
Expand Down Expand Up @@ -145,13 +145,13 @@ protected function prepareWhereString(string $where, array $whereBinder)
* @return Query
* @throws SQLException
*/
protected function prepareIn(string $name, $values)
protected function prepareIn(string $name, string $operation, $values)
{
if ($values instanceof Query || $values instanceof Statement) {
return $this->createQueryOperation($name, 'in', $values);
}
list($inSQL, $binders) = $this->prepareInParameter($values, $name);
$sql = '`'.$name.'` IN ('.$inSQL.')';
$sql = '`'.$name.'` '.strtoupper($operation).' ('.$inSQL.')';
return new Query($sql, $binders);
}

Expand Down Expand Up @@ -187,7 +187,7 @@ private function count($value)
}
return iterator_count($value);
}

/**
* 准备更新
*
Expand Down

0 comments on commit 78e8649

Please sign in to comment.