Fix bug when using multiple order bys in getSelectSQL. Fix ordering in reports list. REL_3-5
authorchriskl <chriskl>
Fri, 4 Nov 2005 04:24:13 +0000 (04:24 +0000)
committerchriskl <chriskl>
Fri, 4 Nov 2005 04:24:13 +0000 (04:24 +0000)
classes/Reports.php
classes/database/Postgres.php

index d3bfd231b5d972edcfb390acb67807e158de8350..70695d906fa46f58aa82d634a043476e05c9d193 100644 (file)
@@ -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);
                }
index e5f12af3b44e2c2e80d22c5feff3a26cda33739f..9244a559e8d88b64627f72a85bc3c8b2c2232ae6 100755 (executable)
@@ -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";
                        }
                }