mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进where方法的原生sql条件 并且支持参数绑定
This commit is contained in:
@@ -311,7 +311,7 @@ abstract class Builder
|
|||||||
$whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value);
|
$whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value);
|
||||||
} elseif ('EXP' == $exp) {
|
} elseif ('EXP' == $exp) {
|
||||||
// 表达式查询
|
// 表达式查询
|
||||||
$whereStr .= $key . ' ' . $value;
|
$whereStr .= '( ' . $key . ' ' . $value . ' )';
|
||||||
} elseif (in_array($exp, ['NOT NULL', 'NULL'])) {
|
} elseif (in_array($exp, ['NOT NULL', 'NULL'])) {
|
||||||
// NULL 查询
|
// NULL 查询
|
||||||
$whereStr .= $key . ' IS ' . $exp;
|
$whereStr .= $key . ' IS ' . $exp;
|
||||||
|
|||||||
@@ -491,7 +491,13 @@ class Query
|
|||||||
if (is_string($field) && !empty($this->options['via'])) {
|
if (is_string($field) && !empty($this->options['via'])) {
|
||||||
$field = $this->options['via'] . '.' . $field;
|
$field = $this->options['via'] . '.' . $field;
|
||||||
}
|
}
|
||||||
if (is_null($op) && is_null($condition)) {
|
if (is_string($field) && strpos($field, ' ')) {
|
||||||
|
$where[] = ['exp', $field];
|
||||||
|
if (is_array($op)) {
|
||||||
|
// 参数绑定
|
||||||
|
$this->bind($op);
|
||||||
|
}
|
||||||
|
} elseif (is_null($op) && is_null($condition)) {
|
||||||
if (is_array($field)) {
|
if (is_array($field)) {
|
||||||
// 数组批量查询
|
// 数组批量查询
|
||||||
$where = $field;
|
$where = $field;
|
||||||
|
|||||||
Reference in New Issue
Block a user