summaryrefslogtreecommitdiffstats
path: root/codebase/db_common.php
diff options
context:
space:
mode:
authorDmitry <dmitry@dhtmlx.com>2012-07-10 17:19:45 +0200
committerDmitry <dmitry@dhtmlx.com>2012-07-10 17:19:45 +0200
commit39a85a6361a2de94c5528344ec88eaed614d743b (patch)
treeeb93300681ec90adee33a4838e662965d26abea3 /codebase/db_common.php
parentfb37b3dc462d73faead66b6c3d16cf5541bde57a (diff)
downloadconnector-php-39a85a6361a2de94c5528344ec88eaed614d743b.zip
connector-php-39a85a6361a2de94c5528344ec88eaed614d743b.tar.gz
connector-php-39a85a6361a2de94c5528344ec88eaed614d743b.tar.bz2
easy sort api
Diffstat (limited to 'codebase/db_common.php')
-rw-r--r--codebase/db_common.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/codebase/db_common.php b/codebase/db_common.php
index 91d3838..2ae9b22 100644
--- a/codebase/db_common.php
+++ b/codebase/db_common.php
@@ -157,8 +157,12 @@ class DataRequestConfig{
if (!$field && !$order)
$this->sort_by=array();
else{
- $order=strtolower($order)=="asc"?"ASC":"DESC";
- $this->sort_by[]=array("name"=>$field,"direction" => $order);
+ if ($order===false)
+ $this->sort_by[] = $field;
+ else {
+ $order=strtolower($order)=="asc"?"ASC":"DESC";
+ $this->sort_by[]=array("name"=>$field,"direction" => $order);
+ }
}
}
/*! sets filtering rule
@@ -713,7 +717,9 @@ abstract class DBDataWrapper extends DataWrapper{
if (!sizeof($by)) return "";
$out = array();
for ($i=0; $i < sizeof($by); $i++)
- if ($by[$i]["name"])
+ if (is_string($by[$i]))
+ $out[] = $by[$i];
+ else if ($by[$i]["name"])
$out[]=$this->escape_name($by[$i]["name"])." ".$by[$i]["direction"];
return implode(",",$out);
}