Think/Db/Driver类 参数绑定方法bindParam改为bindValue

避免多个参数绑定时存在的引用问题
This commit is contained in:
ThinkPHP
2013-04-27 17:55:34 +08:00
parent f3e00893af
commit e4dc3e47d4
2 changed files with 6 additions and 7 deletions

View File

@@ -144,13 +144,12 @@ abstract class Driver {
E($this->error());
foreach ($bind as $key => $val) {
if(is_array($val)){
$this->PDOStatement->bindParam($key, $val[0], $val[1]);
$this->PDOStatement->bindValue($key, $val[0], $val[1]);
}else{
$this->PDOStatement->bindParam($key, $val);
$this->PDOStatement->bindValue($key, $val);
}
}
$result = $this->PDOStatement->execute();
//$result = $this->PDOStatement->execute($bind);
$result = $this->PDOStatement->execute();
// 调试结束
$this->debug(false);
if ( false === $result ) {
@@ -186,9 +185,9 @@ abstract class Driver {
}
foreach ($bind as $key => $val) {
if(is_array($val)){
$this->PDOStatement->bindParam($key, $val[0], $val[1]);
$this->PDOStatement->bindValue($key, $val[0], $val[1]);
}else{
$this->PDOStatement->bindParam($key, $val);
$this->PDOStatement->bindValue($key, $val);
}
}
$result = $this->PDOStatement->execute();

View File

@@ -160,4 +160,4 @@ class Sqlsrv extends Driver{
return $this->execute($sql,$this->parseBind(!empty($options['bind'])?$options['bind']:[]));
}
}
}