think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

[bug] query原生参数绑定,值始终为string

Open yuyachong opened this issue 2 years ago • 0 comments

$ceshi = 11; $ceshi1 = 22; Db::query("update xxx set content = json_replace(content, '$.day', JSON_ARRAY(:ceshi, :ceshi1)) where name = 'xxx'", [ 'ceshi' => $ceshi, 'ceshi1' => $ceshi1 ]);

为题所在: PDOConnection.php(bindValue方法中)$result = $this->PDOStatement->bindValue($param, $val); 使用了默认PDO::PARAM_STR 没有进行值的检测


比较纳闷的是bindValue方法中有个is_array检测, Db::query('sql....', [ 'param_1' => [111,111] 'param_2' => [222,222] ]); 再次运行上方的sql,发现参数绑定值为int了........... 这么是何用? 官方给个答复呀

yuyachong avatar Oct 07 '22 07:10 yuyachong