From 8a516c52429e2a85ccd9dd30538c5779e88dc249 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Sat, 27 Apr 2013 14:08:45 +0800 Subject: [PATCH] =?UTF-8?q?sqlsrv=E9=A9=B1=E5=8A=A8=E5=A2=9E=E5=8A=A0parse?= =?UTF-8?q?Key=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Think/Db/Driver/Sqlsrv.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Think/Db/Driver/Sqlsrv.php b/Library/Think/Db/Driver/Sqlsrv.php index 07329ed0..f567d9ea 100644 --- a/Library/Think/Db/Driver/Sqlsrv.php +++ b/Library/Think/Db/Driver/Sqlsrv.php @@ -96,6 +96,20 @@ class Sqlsrv extends Driver{ return !empty($order)? ' ORDER BY '.$order:' ORDER BY rand()'; } + /** + * 字段名分析 + * @access protected + * @param string $key + * @return string + */ + protected function parseKey(&$key) { + $key = trim($key); + if(!preg_match('/[,\'\"\*\(\)\[.\s]/',$key)) { + $key = '['.$key.']'; + } + return $key; + } + /** * limit * @access public