mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
改进查询条件的自动参数绑定
This commit is contained in:
@@ -412,13 +412,17 @@ abstract class Connection
|
||||
{
|
||||
if ($bind) {
|
||||
foreach ($bind as $key => $val) {
|
||||
$val = $this->quote(is_array($val) ? $val[0] : $val);
|
||||
$value = is_array($val) ? $val[0] : $val;
|
||||
$type = is_array($val) ? $val[1] : PDO::PARAM_STR;
|
||||
if (PDO::PARAM_STR == $type) {
|
||||
$value = $this->quote($value);
|
||||
}
|
||||
// 判断占位符
|
||||
$sql = is_numeric($key) ?
|
||||
substr_replace($sql, $val, strpos($sql, '?'), 1) :
|
||||
substr_replace($sql, $value, strpos($sql, '?'), 1) :
|
||||
str_replace(
|
||||
[':' . $key . ')', ':' . $key . ',', ':' . $key . ' '],
|
||||
[$val . ')', $val . ',', $val . ' '],
|
||||
[$value . ')', $value . ',', $value . ' '],
|
||||
$sql . ' ');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user