change ANALYZE to VACUUM ANALYZE for pre 7.2. remove unused getTableKeys function
authorchriskl <chriskl>
Mon, 19 May 2003 15:15:49 +0000 (15:15 +0000)
committerchriskl <chriskl>
Mon, 19 May 2003 15:15:49 +0000 (15:15 +0000)
classes/database/Postgres.php
classes/database/Postgres72.php

index e96e864128996eac825b98e9e876600cafde9421..a559ae4713758e647c18257a1c31aa00b3798c65 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.111 2003/05/19 15:08:09 chriskl Exp $
+ * $Id: Postgres.php,v 1.112 2003/05/19 15:15:49 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -2079,10 +2079,10 @@ class Postgres extends BaseDB {
        function analyzeDB($table = '') {
                if ($table != '') {
                        $this->fieldClean($table);
-                       $sql = "ANALYZE \"{$table}\"";
+                       $sql = "VACUUM ANALYZE \"{$table}\"";
                }
                else
-                       $sql = "ANALYZE";
+                       $sql = "VACUUM ANALYZE";
 
                return $this->execute($sql);
        }
index 324a6bf4a3fcbcbba861c1855bbac6bc2981a0c6..e509731fb5718db9d1aa7238b4a675c0ed815a1b 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres72.php,v 1.44 2003/05/15 14:34:47 chriskl Exp $
+ * $Id: Postgres72.php,v 1.45 2003/05/19 15:15:49 chriskl Exp $
  */
 
 
@@ -102,37 +102,6 @@ class Postgres72 extends Postgres71 {
                return $this->selectSet($sql);
        }
 
-       function getTableKeys($table) {
-               $this->clean($table);
-
-               $sql = "
-                               SELECT 
-                                       ic.relname AS index_name, 
-                                       bc.relname AS tab_name, 
-                                       ta.attname AS column_name,
-                                       i.indisunique AS unique_key,
-                                       i.indisprimary AS primary_key
-                               FROM 
-                                       pg_class bc,
-                                       pg_class ic,
-                                       pg_index i,
-                                       pg_attribute ta,
-                                       pg_attribute ia
-                               WHERE 
-                                       bc.oid = i.indrelid
-                                       AND ic.oid = i.indexrelid
-                                       AND ia.attrelid = i.indexrelid
-                                       AND ta.attrelid = bc.oid
-                                       AND bc.relname = '$table'
-                                       AND ta.attrelid = i.indrelid
-                                       AND ta.attnum = i.indkey[ia.attnum-1]
-                               ORDER BY 
-                                       index_name, tab_name, column_name
-                               ";
-
-               return $this->selectSet($sql);
-       }
-
        // Constraint functions
 
        /**
@@ -289,6 +258,23 @@ class Postgres72 extends Postgres71 {
                return $this->selectSet($sql);
        }
 
+       // Administration functions
+
+       /**
+        * Analyze a database
+        * @note PostgreSQL 7.2 finally had an independent ANALYZE command
+        * @param $table (optional) The table to analyze
+        */
+       function analyzeDB($table = '') {
+               if ($table != '') {
+                       $this->fieldClean($table);
+                       $sql = "ANALYZE \"{$table}\"";
+               }
+               else
+                       $sql = "ANALYZE";
+
+               return $this->execute($sql);
+       }
 }
 
 ?>