From f1c9a3bb8886d2bf85ac0c258c3325bf04cc087e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 13 Sep 2016 13:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8F=82=E6=95=B0=E7=BB=91=E5=AE=9A=20?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Builder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index dd6d0f12..852b3a77 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -296,9 +296,9 @@ 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->isBind($field)) { - $this->query->bind($field, $value, $bindType); - $value = ':' . $field; + 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; } $whereStr = ''; if (in_array($exp, ['=', '<>', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE'])) { @@ -339,7 +339,7 @@ abstract class Builder $whereStr .= $exp . ' (' . $value . ')'; } } elseif (in_array($exp, ['< TIME', '> TIME', '<= TIME', '>= TIME'])) { - $whereStr .= $key . ' ' . substr($exp, 0, 2) . ' ' . $this->parseDateTime($value, $field, $options, $field, $bindType); + $whereStr .= $key . ' ' . substr($exp, 0, 2) . ' ' . $this->parseDateTime($value, $field, $options, 'where_' . $field, $bindType); } elseif (in_array($exp, ['BETWEEN TIME', 'NOT BETWEEN TIME'])) { if (is_string($value)) { $value = explode(',', $value);