add comments on constraints and indexes
authorioguix <ioguix>
Sat, 29 Sep 2007 09:09:45 +0000 (09:09 +0000)
committerioguix <ioguix>
Sat, 29 Sep 2007 09:09:45 +0000 (09:09 +0000)
classes/database/Postgres.php
classes/database/Postgres73.php
classes/database/Postgres74.php
classes/database/Postgres82.php
constraints.php
indexes.php
tblproperties.php

index 3b8660c0a3c0783e3b23851168972c802eceb4f5..ee00378baa6163ac7736a19274b1c9cd04ed137f 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.304 2007/09/18 05:03:29 xzilla Exp $
+ * $Id: Postgres.php,v 1.305 2007/09/29 09:09:45 ioguix Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -2220,7 +2220,8 @@ class Postgres extends ADODB_base {
         */
        function getIndexes($table = '', $unique = false) {
                $this->clean($table);
-               $sql = "SELECT c2.relname AS indname, i.indisprimary, i.indisunique, pg_get_indexdef(i.indexrelid) AS inddef
+               $sql = "SELECT c2.relname AS indname, i.indisprimary, i.indisunique, pg_get_indexdef(i.indexrelid) AS inddef,
+                               pg_catalog.obj_description(c.oid, 'pg_index') AS idxcomment
                        FROM pg_class c, pg_class c2, pg_index i
                        WHERE c.relname = '{$table}' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
                ";
@@ -4713,7 +4714,8 @@ class Postgres extends ADODB_base {
        function hasUserRename() { return false; }
        function hasRecluster() { return false; }
        function hasFullVacuum() { return false; }
-       function hasForeignKeysInfo() { return false; }
+       function hasConstraintsInfo() { return false; }
+       function hasForeignKeysInfo() { return $this->hasConstraintsInfo(); }
        function hasViewColumnRename() { return false; }
        function hasTablespaces() { return false; }
        function hasSignals() { return false; }
index 753f5cf54516069f420b4e95d7945be0f62374c5..d49a34309a4ba19967d7bd8c7b11978d8af104e7 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres73.php,v 1.171 2007/09/29 09:00:33 ioguix Exp $
+ * $Id: Postgres73.php,v 1.172 2007/09/29 09:09:45 ioguix Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -759,7 +759,8 @@ class Postgres73 extends Postgres72 {
                $this->clean($table);
                
                $sql = "SELECT c2.relname AS indname, i.indisprimary, i.indisunique, i.indisclustered,
-                       pg_catalog.pg_get_indexdef(i.indexrelid) AS inddef
+                       pg_catalog.pg_get_indexdef(i.indexrelid) AS inddef,
+                       pg_catalog.obj_description(c.oid, 'pg_index') AS idxcomment
                        FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
                        WHERE c.relname = '{$table}' AND pg_catalog.pg_table_is_visible(c.oid) 
                        AND c.oid = i.indrelid AND i.indexrelid = c2.oid
@@ -1237,7 +1238,8 @@ class Postgres73 extends Postgres72 {
                        SELECT
                                c.contype, c.conname, pg_catalog.pg_get_constraintdef(c.oid) AS consrc, 
                                ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema,
-                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field
+                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field,
+                               pg_catalog.obj_description(c.oid, \'pg_constraint\') AS constcomment
                        FROM
                                pg_catalog.pg_constraint AS c
                                JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid)
@@ -1953,7 +1955,8 @@ class Postgres73 extends Postgres72 {
        function hasUserSessionDefaults() { return true; }
        function hasVariables() { return true; }
        function hasFullExplain() { return true; }
-       function hasForeignKeysInfo() { return true; }
+//     function hasForeignKeysInfo() { return true; }
+       function hasConstraintsInfo() { return true; }
        function hasViewColumnRename() { return true; }
        function hasUserAndDbVariables() { return true; }
        function hasCompositeTypes() { return true; }   
index fe5d245cc69045a20c2670df4c81a7955476bed4..ebebc4d6acdb538754c5e2ad8f35adb1d85d60a8 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres74.php,v 1.62 2007/09/29 09:00:33 ioguix Exp $
+ * $Id: Postgres74.php,v 1.63 2007/09/29 09:09:45 ioguix Exp $
  */
 
 include_once('./classes/database/Postgres73.php');
@@ -180,7 +180,8 @@ class Postgres74 extends Postgres73 {
                        SELECT
                                c.contype, c.conname, pg_catalog.pg_get_constraintdef(c.oid,true) AS consrc, 
                                ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema,
-                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field
+                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field,
+                               pg_catalog.obj_description(c.oid, \'pg_constraint\') AS constcomment
                        FROM
                                pg_catalog.pg_constraint AS c
                                JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid)
index 195d8fcd4d375316438c4d5dd16416b0366c9f84..779e7a4ae5fcc63bf344013070d65b393dc2b6f8 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * PostgreSQL 8.2 support
  *
- * $Id: Postgres82.php,v 1.7 2007/09/21 20:00:38 ioguix Exp $
+ * $Id: Postgres82.php,v 1.8 2007/09/29 09:09:45 ioguix Exp $
  */
 
 include_once('./classes/database/Postgres81.php');
@@ -230,7 +230,8 @@ class Postgres82 extends Postgres81 {
                        SELECT
                                c.contype, c.conname, pg_catalog.pg_get_constraintdef(c.oid, true) AS consrc, 
                                ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema,
-                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field
+                               r2.relname as f_table, f1.attname as p_field, f2.attname as f_field,
+                               pg_catalog.obj_description(c.oid, \'pg_constraint\') AS constcomment
                        FROM
                                pg_catalog.pg_constraint AS c
                                JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid)
index 39f0ee742919c23facee12cd0151637141af0dcd..d70e62ee83cf21450e97f1901a5eeba9c560abc2 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List constraints on a table
         *
-        * $Id: constraints.php,v 1.53 2007/09/13 13:41:01 ioguix Exp $
+        * $Id: constraints.php,v 1.54 2007/09/29 09:09:45 ioguix Exp $
         */
 
        // Include application functions
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
+                       'comment' => array(
+                               'title' => $lang['strcomment'],
+                               'field' => field('constcomment'),
+                       ),
                );
+
+               if (!$data->hasConstraintsInfo()) unset($columns['comment']);
                
                $actions = array(
                        'drop' => array(
index db8c10e8b306505ea3008b7760ef2dea0b45df11..0a56bc1c3e1a40561514e70191e915f18a9ae96d 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List indexes on a table
         *
-        * $Id: indexes.php,v 1.44 2007/08/31 18:30:11 ioguix Exp $
+        * $Id: indexes.php,v 1.45 2007/09/29 09:09:45 ioguix Exp $
         */
 
        // Include application functions
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
+                       'comment' => array(
+                               'title' => $lang['strcomment'],
+                               'field' => field('idxcomment'),
+                       ),
                );
                
                $actions = array(
index ddffc64b4674e125347613b9941ae4926ae2228f..fe61ff59655345f63a225b065ddacfb35475b6b9 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tblproperties.php,v 1.86 2007/09/28 12:05:56 ioguix Exp $
+        * $Id: tblproperties.php,v 1.87 2007/09/29 09:09:45 ioguix Exp $
         */
 
        // Include application functions
                                'field' => field('comment'),
                        ),
                );
-               if (!$data->hasForeignKeysInfo()) {
+               if (!$data->hasConstraintsInfo()) {
                        unset($columns['keyprop']);
                }
                else {