参数自动绑定采用数字key 避免sqlsrv不支持的情况

This commit is contained in:
ThinkPHP
2013-04-27 13:24:11 +08:00
parent 5995908cbb
commit 6665cc8f88

View File

@@ -329,8 +329,8 @@ abstract class Driver {
if(0===strpos($val,':')){ if(0===strpos($val,':')){
$set[] = $this->parseKey($key).'='.$this->parseValue($val); $set[] = $this->parseKey($key).'='.$this->parseValue($val);
}else{ }else{
$name = md5($key); $name = count($this->bind);
$set[] = $this->parseKey($key).'=:T'.$name; $set[] = $this->parseKey($key).'=:'.$name;
$this->bindParam($name,$val); $this->bindParam($name,$val);
} }
} }
@@ -346,7 +346,7 @@ abstract class Driver {
* @return void * @return void
*/ */
protected function bindParam($name,$value){ protected function bindParam($name,$value){
$this->bind[':T'.$name] = $value; $this->bind[':'.$name] = $value;
} }
/** /**
@@ -747,8 +747,8 @@ abstract class Driver {
if(0===strpos($val,':')){ if(0===strpos($val,':')){
$values[] = $this->parseValue($val); $values[] = $this->parseValue($val);
}else{ }else{
$name = md5($key); $name = count($this->bind);
$values[] = ':T'.$name; $values[] = ':'.$name;
$this->bindParam($name,$val); $this->bindParam($name,$val);
} }
} }