From 8f59235a0a8fa850f382a330f01e2beabcbf0af6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 8 Oct 2016 10:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3sqlsrv=E9=A9=B1=E5=8A=A8parse?= =?UTF-8?q?Order=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/builder/Sqlsrv.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/think/db/builder/Sqlsrv.php b/library/think/db/builder/Sqlsrv.php index c53f3848..d2f418f3 100644 --- a/library/think/db/builder/Sqlsrv.php +++ b/library/think/db/builder/Sqlsrv.php @@ -27,22 +27,23 @@ class Sqlsrv extends Builder * order分析 * @access protected * @param mixed $order + * @param array $options * @return string */ - protected function parseOrder($order) + protected function parseOrder($order, $options = []) { if (is_array($order)) { $array = []; foreach ($order as $key => $val) { if (is_numeric($key)) { if (false === strpos($val, '(')) { - $array[] = $this->parseKey($val); + $array[] = $this->parseKey($val, $options); } elseif ('[rand]' == $val) { $array[] = $this->parseRand(); } } else { $sort = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : ''; - $array[] = $this->parseKey($key) . ' ' . $sort; + $array[] = $this->parseKey($key, $options) . ' ' . $sort; } } $order = implode(',', $array);