mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进查询条件的参数绑定
This commit is contained in:
@@ -296,10 +296,13 @@ abstract class Builder
|
||||
}
|
||||
}
|
||||
$bindType = isset($binds[$field]) ? $binds[$field] : PDO::PARAM_STR;
|
||||
if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false && strpos($value, ':') !== 0) {
|
||||
$this->query->bind('where_' . $field, $value, $bindType);
|
||||
$value = ':where_' . $field;
|
||||
if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) {
|
||||
if (strpos($value, ':') !== 0 || !$this->query->isBind(substr($value, 1))) {
|
||||
$this->query->bind('where_' . $field, $value, $bindType);
|
||||
$value = ':where_' . $field;
|
||||
}
|
||||
}
|
||||
|
||||
$whereStr = '';
|
||||
if (in_array($exp, ['=', '<>', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE'])) {
|
||||
// 比较运算 及 模糊匹配
|
||||
|
||||
Reference in New Issue
Block a user