修整db->Driver中order解析方法

This commit is contained in:
小陈叔叔
2016-01-22 15:00:56 +08:00
parent ec4f187aab
commit 57371d7aa1

View File

@@ -736,8 +736,8 @@ abstract class Driver
*/ */
protected function parseOrder($order) protected function parseOrder($order)
{ {
$array = [];
if (is_array($order)) { if (is_array($order)) {
$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, '(')) {
@@ -750,8 +750,8 @@ abstract class Driver
$array[] = $this->parseKey($key) . ' ' . $sort; $array[] = $this->parseKey($key) . ' ' . $sort;
} }
} }
}
$order = implode(',', $array); $order = implode(',', $array);
}
return !empty($order) ? ' ORDER BY ' . $order : ''; return !empty($order) ? ' ORDER BY ' . $order : '';
} }