diff options
author | chriskl | 2005-11-04 04:24:13 +0000 |
---|---|---|
committer | chriskl | 2005-11-04 04:24:13 +0000 |
commit | 16d1eb48ce74e3d0858a9db89d67ce9b806faad6 (patch) | |
tree | 9c6677b69b21da0e3f102d1c71a3c4f143ba15d8 | |
parent | b139f7b149cf395d409f409045be8ad06055b164 (diff) |
Fix bug when using multiple order bys in getSelectSQL. Fix ordering in reports list.REL_3-5
-rw-r--r-- | classes/Reports.php | 4 | ||||
-rwxr-xr-x | classes/database/Postgres.php | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/classes/Reports.php b/classes/Reports.php index d3bfd231..70695d90 100644 --- a/classes/Reports.php +++ b/classes/Reports.php @@ -4,7 +4,7 @@ * the functions provided by the database driver exclusively, and hence * will work with any database without modification. * - * $Id: Reports.php,v 1.11.2.2 2005/10/18 03:15:57 chriskl Exp $ + * $Id: Reports.php,v 1.11.2.3 2005/11/04 04:24:13 chriskl Exp $ */ class Reports { @@ -44,7 +44,7 @@ $sql = $this->driver->getSelectSQL('ppa_reports', array('report_id', 'report_name', 'db_name', 'date_created', 'created_by', 'descr', 'report_sql'), - $filter, $ops, array(2 => 'asc')); + $filter, $ops, array('db_name' => 'asc', 'report_name' => 'asc')); return $this->driver->selectSet($sql); } diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index e5f12af3..9244a559 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.250.2.7 2005/10/18 03:15:58 chriskl Exp $ + * $Id: Postgres.php,v 1.250.2.8 2005/11/04 04:24:13 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -3806,8 +3806,17 @@ class Postgres extends ADODB_base { // ORDER BY if (is_array($orderby) && sizeof($orderby) > 0) { $sql .= " ORDER BY "; + $first = true; foreach ($orderby as $k => $v) { - $sql .= $k; + if ($first) $first = false; + else $sql .= ', '; + if (ereg('^[0-9]+$', $k)) { + $sql .= $k; + } + else { + $this->fieldClean($k); + $sql .= '"' . $k . '"'; + } if (strtoupper($v) == 'DESC') $sql .= " DESC"; } } |