From e4d4911b461d08f88120a0277c23f9b58f6b3187 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 13 Apr 2018 11:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=B8=80=E5=A4=84mysql?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/builder/Mysql.php | 3 ++- library/think/db/builder/Sqlsrv.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/library/think/db/builder/Mysql.php b/library/think/db/builder/Mysql.php index 465e9485..94f82b83 100644 --- a/library/think/db/builder/Mysql.php +++ b/library/think/db/builder/Mysql.php @@ -105,7 +105,8 @@ class Mysql extends Builder $table = $options['alias'][$table]; } } - if ($strict || !preg_match('/[,\'\"\*\(\)`.\s]/', $key)) { + + if ('*' != $key && ($strict || !preg_match('/[,\'\"\*\(\)`.\s]/', $key))) { $key = '`' . $key . '`'; } if (isset($table)) { diff --git a/library/think/db/builder/Sqlsrv.php b/library/think/db/builder/Sqlsrv.php index b97886ac..e904827a 100644 --- a/library/think/db/builder/Sqlsrv.php +++ b/library/think/db/builder/Sqlsrv.php @@ -92,7 +92,7 @@ class Sqlsrv extends Builder $table = $options['alias'][$table]; } } - if ($strict || !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) { + if ('*' != $key && ($strict || !preg_match('/[,\'\"\*\(\)\[.\s]/', $key))) { $key = '[' . $key . ']'; } if (isset($table)) {