mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正sqlsrv驱动parseOrder方法
This commit is contained in:
@@ -27,22 +27,23 @@ class Sqlsrv extends Builder
|
|||||||
* order分析
|
* order分析
|
||||||
* @access protected
|
* @access protected
|
||||||
* @param mixed $order
|
* @param mixed $order
|
||||||
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function parseOrder($order)
|
protected function parseOrder($order, $options = [])
|
||||||
{
|
{
|
||||||
if (is_array($order)) {
|
if (is_array($order)) {
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach ($order as $key => $val) {
|
foreach ($order as $key => $val) {
|
||||||
if (is_numeric($key)) {
|
if (is_numeric($key)) {
|
||||||
if (false === strpos($val, '(')) {
|
if (false === strpos($val, '(')) {
|
||||||
$array[] = $this->parseKey($val);
|
$array[] = $this->parseKey($val, $options);
|
||||||
} elseif ('[rand]' == $val) {
|
} elseif ('[rand]' == $val) {
|
||||||
$array[] = $this->parseRand();
|
$array[] = $this->parseRand();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$sort = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : '';
|
$sort = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : '';
|
||||||
$array[] = $this->parseKey($key) . ' ' . $sort;
|
$array[] = $this->parseKey($key, $options) . ' ' . $sort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$order = implode(',', $array);
|
$order = implode(',', $array);
|
||||||
|
|||||||
Reference in New Issue
Block a user