mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正PDO参数绑定的一处BUG
This commit is contained in:
@@ -178,11 +178,6 @@ class View
|
||||
$replace = $this->config['parse_str'];
|
||||
$content = str_replace(array_keys($replace), array_values($replace), $content);
|
||||
}
|
||||
if (APP_DEBUG && $this->config['parse_var']) {
|
||||
// debug模式时,将后台分配变量输出到浏览器控制台
|
||||
$parseVar = empty($vars) ? json_encode([]) : json_encode($vars);
|
||||
$content .= '<script type="text/javascript">var __VAR__ = ' . $parseVar . ';</script>';
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
@@ -432,8 +432,8 @@ abstract class Driver
|
||||
$set[] = $this->parseKey($key) . '=' . $val;
|
||||
} else {
|
||||
$name = count($this->bind);
|
||||
$set[] = $this->parseKey($key) . '=:' . $name;
|
||||
$this->bindParam($name, $val);
|
||||
$set[] = $this->parseKey($key) . '=:' . $key . '_' . $name;
|
||||
$this->bindParam($key . '_' . $name, $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,7 +458,7 @@ abstract class Driver
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey(&$key)
|
||||
protected function parseKey($key)
|
||||
{
|
||||
return $key;
|
||||
}
|
||||
@@ -539,8 +539,7 @@ abstract class Driver
|
||||
}
|
||||
$tables = $array;
|
||||
} elseif (is_string($tables)) {
|
||||
$tables = explode(',', $tables);
|
||||
array_walk($tables, [ & $this, 'parseKey']);
|
||||
$tables = array_map([$this, 'parseKey'], explode(',', $tables));
|
||||
}
|
||||
return implode(',', $tables);
|
||||
}
|
||||
@@ -913,8 +912,8 @@ abstract class Driver
|
||||
$values[] = $val;
|
||||
} else {
|
||||
$name = count($this->bind);
|
||||
$values[] = ':' . $name;
|
||||
$this->bindParam($name, $val);
|
||||
$values[] = ':' . $key . '_' . $name;
|
||||
$this->bindParam($key . '_' . $name, $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -983,8 +982,8 @@ abstract class Driver
|
||||
$fields = explode(',', $fields);
|
||||
}
|
||||
|
||||
array_walk($fields, [$this, 'parseKey']);
|
||||
$sql = 'INSERT INTO ' . $this->parseTable($table) . ' (' . implode(',', $fields) . ') ';
|
||||
$fields = array_map([$this, 'parseKey'], $fields);
|
||||
$sql = 'INSERT INTO ' . $this->parseTable($table) . ' (' . implode(',', $fields) . ') ';
|
||||
$sql .= $this->buildSelectSql($options);
|
||||
return $this->execute($sql, !empty($options['fetch_sql']) ? true : false);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class Mysql extends Driver
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey(&$key)
|
||||
protected function parseKey($key)
|
||||
{
|
||||
$key = trim($key);
|
||||
if (strpos($key, '$.') && false === strpos($key, '(')) {
|
||||
|
||||
@@ -179,7 +179,7 @@ class Oracle extends Driver
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey(&$key)
|
||||
protected function parseKey($key)
|
||||
{
|
||||
$key = trim($key);
|
||||
if (strpos($key, '$.') && false === strpos($key, '(')) {
|
||||
|
||||
@@ -100,7 +100,7 @@ class Pgsql extends Driver
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey(&$key)
|
||||
protected function parseKey($key)
|
||||
{
|
||||
$key = trim($key);
|
||||
if (strpos($key, '$.') && false === strpos($key, '(')) {
|
||||
|
||||
@@ -108,7 +108,7 @@ class Sqlsrv extends Driver
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseKey(&$key)
|
||||
protected function parseKey($key)
|
||||
{
|
||||
$key = trim($key);
|
||||
if (!preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) {
|
||||
|
||||
Reference in New Issue
Block a user