Fix schema support in WHERE clauses used by info.php . Comment fix for dbexport.php
authorsoranzo <soranzo>
Wed, 25 Feb 2004 15:46:22 +0000 (15:46 +0000)
committersoranzo <soranzo>
Wed, 25 Feb 2004 15:46:22 +0000 (15:46 +0000)
classes/database/Postgres.php
dbexport.php

index f787215d33d723e92c88b602244395c26703c31b..036c6e10411e3737b4dc21782d5b275d3b73f9f3 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.182 2004/02/13 12:42:12 chriskl Exp $
+ * $Id: Postgres.php,v 1.183 2004/02/25 15:46:22 soranzo Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -3425,8 +3425,9 @@ class Postgres extends BaseDB {
        function &getStatsTableTuples($table) {
                $this->clean($table);
 
-               $sql = "SELECT * FROM pg_stat_all_tables WHERE schemaname='{$this->_schema}'
-                       AND relname='{$table}'";
+               $sql = 'SELECT * FROM pg_stat_all_tables WHERE';
+               if ($this->hasSchemas()) $sql .= " schemaname='{$this->_schema}' AND";
+               $sql .= " relname='{$table}'";
 
                return $this->selectSet($sql);
        }
@@ -3439,8 +3440,9 @@ class Postgres extends BaseDB {
        function &getStatsTableIO($table) {
                $this->clean($table);
 
-               $sql = "SELECT * FROM pg_statio_all_tables WHERE schemaname='{$this->_schema}'
-                       AND relname='{$table}'";
+               $sql = 'SELECT * FROM pg_statio_all_tables WHERE';
+               if ($this->hasSchemas()) $sql .= " schemaname='{$this->_schema}' AND";
+               $sql .= " relname='{$table}'";
 
                return $this->selectSet($sql);
        }
@@ -3453,8 +3455,9 @@ class Postgres extends BaseDB {
        function &getStatsIndexTuples($table) {
                $this->clean($table);
 
-               $sql = "SELECT * FROM pg_stat_all_indexes WHERE schemaname='{$this->_schema}'
-                       AND relname='{$table}' ORDER BY indexrelname";
+               $sql = 'SELECT * FROM pg_stat_all_indexes WHERE';
+               if ($this->hasSchemas()) $sql .= " schemaname='{$this->_schema}' AND";
+               $sql .= " relname='{$table}' ORDER BY indexrelname";
 
                return $this->selectSet($sql);
        }
@@ -3467,8 +3470,9 @@ class Postgres extends BaseDB {
        function &getStatsIndexIO($table) {
                $this->clean($table);
 
-               $sql = "SELECT * FROM pg_statio_all_indexes WHERE schemaname='{$this->_schema}'
-                       AND relname='{$table}' ORDER BY indexrelname";
+               $sql = 'SELECT * FROM pg_statio_all_indexes WHERE';
+               if ($this->hasSchemas()) $sql .= " schemaname='{$this->_schema}' AND";
+               $sql .= " relname='{$table}' ORDER BY indexrelname";
 
                return $this->selectSet($sql);
        }
index 0cde9bc2a0c970add25f587312714c97f4b9bca4..19e71aa8cb18119516fd006111b0ca92a1d9dcac 100644 (file)
@@ -1,9 +1,9 @@
 <?php
        /**
-        * Does an export of a database to the screen or as a download.
-        * Can also dump a specific table of a database.
+        * Does an export of a database or a table (via pg_dump)
+        * to the screen or as a download.
         *
-        * $Id: dbexport.php,v 1.7 2004/01/29 07:30:11 chriskl Exp $
+        * $Id: dbexport.php,v 1.8 2004/02/25 15:46:22 soranzo Exp $
         */
 
        // Include application functions