内核更新

This commit is contained in:
2016-09-14 13:39:11 +08:00
parent d639c7d5f5
commit 3a6802216e
9 changed files with 136 additions and 43 deletions

View File

@@ -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 . ' ');
}
}
@@ -736,7 +740,7 @@ abstract class Connection
* @param bool $master 是否主库查询
* @return string
*/
public function quote($str, $master = false)
public function quote($str, $master = true)
{
$this->initConnect($master);
return $this->linkID ? $this->linkID->quote($str) : $str;