mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正数据库字段大小写设置问题 修正Query类的where方法对原生sql条件的判断
This commit is contained in:
@@ -49,6 +49,8 @@ abstract class Connection
|
|||||||
protected $linkID;
|
protected $linkID;
|
||||||
// 查询结果类型
|
// 查询结果类型
|
||||||
protected $fetchType = PDO::FETCH_ASSOC;
|
protected $fetchType = PDO::FETCH_ASSOC;
|
||||||
|
// 字段属性大小写
|
||||||
|
protected $attrCase = PDO::CASE_LOWER;
|
||||||
// 监听回调
|
// 监听回调
|
||||||
protected static $event = [];
|
protected static $event = [];
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ abstract class Connection
|
|||||||
protected function fieldCase($info)
|
protected function fieldCase($info)
|
||||||
{
|
{
|
||||||
// 字段大小写转换
|
// 字段大小写转换
|
||||||
switch ($this->params[PDO::ATTR_CASE]) {
|
switch ($this->attrCase) {
|
||||||
case PDO::CASE_LOWER:
|
case PDO::CASE_LOWER:
|
||||||
$info = array_change_key_case($info);
|
$info = array_change_key_case($info);
|
||||||
break;
|
break;
|
||||||
@@ -188,6 +190,8 @@ abstract class Connection
|
|||||||
} else {
|
} else {
|
||||||
$params = $this->params;
|
$params = $this->params;
|
||||||
}
|
}
|
||||||
|
// 记录当前字段属性大小写设置
|
||||||
|
$this->attrCase = $params[PDO::ATTR_CASE];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (empty($config['dsn'])) {
|
if (empty($config['dsn'])) {
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ class Query
|
|||||||
if (is_string($field) && !empty($this->options['via'])) {
|
if (is_string($field) && !empty($this->options['via'])) {
|
||||||
$field = $this->options['via'] . '.' . $field;
|
$field = $this->options['via'] . '.' . $field;
|
||||||
}
|
}
|
||||||
if (is_string($field) && preg_match('/[,=\>\<\'\"\(`.\s]/', $field)) {
|
if (is_string($field) && preg_match('/[,=\>\<\'\"\(\s]/', $field)) {
|
||||||
$where[] = ['exp', $field];
|
$where[] = ['exp', $field];
|
||||||
if (is_array($op)) {
|
if (is_array($op)) {
|
||||||
// 参数绑定
|
// 参数绑定
|
||||||
|
|||||||
Reference in New Issue
Block a user