Add a constraints column in the tblproperties field page for pg 7.3+
authorioguix <ioguix>
Fri, 31 Aug 2007 18:30:10 +0000 (18:30 +0000)
committerioguix <ioguix>
Fri, 31 Aug 2007 18:30:10 +0000 (18:30 +0000)
32 files changed:
aggregates.php
all_db.php
casts.php
classes/Misc.php
classes/database/Postgres73.php
classes/database/Postgres74.php
colproperties.php
constraints.php
conversions.php
database.php
domains.php
functions.php
groups.php
indexes.php
languages.php
opclasses.php
operators.php
plugin_slony.php
reports.php
roles.php
rules.php
schemas.php
sequences.php
servers.php
tables.php
tablespaces.php
tblproperties.php
triggers.php
types.php
users.php
viewproperties.php
views.php

index ddc3b1d6f3755d63fd9f105aef425d25feb9586d..3e19bc2630c5b8ffb440190f80dae76bc6c9a6af 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage aggregates in a database
         *
-        * $Id: aggregates.php,v 1.23 2007/07/16 21:27:28 ioguix Exp $
+        * $Id: aggregates.php,v 1.24 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'aggrname' => array(
                                'title' => $lang['strname'],
-                               'field' => 'proname',
+                               'field' => field('proname'),
                                'url'   => "redirect.php?subject=aggregate&amp;action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('aggrname' => 'proname', 'aggrtype' => 'proargtypes'),
                        ),
                        'aggrtype' => array(
                                'title' => $lang['strtype'],
-                               'field' => 'proargtypes',
+                               'field' => field('proargtypes'),
                        ),
                        'aggrtransfn' => array(
                                'title' => $lang['straggrsfunc'],
-                               'field' => 'aggtransfn',
+                               'field' => field('aggtransfn'),
                        ),                      
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'usename',
+                               'field' => field('usename'),
                        ),                      
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),                      
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'aggrcomment',
+                               'field' => field('aggrcomment'),
                        ),
                );
                
index 449a140d1160e5cab619048463b8261e5b40b38b..c8262f73a810bf2787bdd89eb3f59bad6cb33b37 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage databases within a server
         *
-        * $Id: all_db.php,v 1.56 2007/07/17 14:59:52 ioguix Exp $
+        * $Id: all_db.php,v 1.57 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'database' => array(
                                'title' => $lang['strdatabase'],
-                               'field' => 'datname',
+                               'field' => field('datname'),
                                'url'   => "redirect.php?subject=database&amp;{$misc->href}&amp;",
                                'vars'  => array('database' => 'datname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'datowner',
+                               'field' => field('datowner'),
                        ),
                        'encoding' => array(
                                'title' => $lang['strencoding'],
-                               'field' => 'datencoding',
+                               'field' => field('datencoding'),
                        ),
                        'tablespace' => array(
                                'title' => $lang['strtablespace'],
-                               'field' => 'tablespace',
+                               'field' => field('tablespace'),
                        ),
                        'dbsize' => array(
                                'title' => $lang['strsize'],
-                               'field' => 'dbsize',
+                               'field' => field('dbsize'),
                                'type' => 'prettysize',
                        ),
                        'actions' => array(
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'datcomment',
+                               'field' => field('datcomment'),
                        ),
                );
                
index 523235aa1cbd59599b7a120be6cf1bbd9ba76423..7e2a587d0b2aa8eae6c18bd7a19e87ea85621ec3 100644 (file)
--- a/casts.php
+++ b/casts.php
@@ -3,7 +3,7 @@
        /**
         * Manage casts in a database
         *
-        * $Id: casts.php,v 1.14 2007/07/12 19:26:22 xzilla Exp $
+        * $Id: casts.php,v 1.15 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'source_type' => array(
                                'title' => $lang['strsourcetype'],
-                               'field' => 'castsource',
+                               'field' => field('castsource'),
                        ),
                        'target_type' => array(
                                'title' => $lang['strtargettype'],
-                               'field' => 'casttarget',
+                               'field' => field('casttarget'),
                        ),
                        'function' => array(
                                'title' => $lang['strfunction'],
-                               'field' => 'castfunc',
+                               'field' => field('castfunc'),
                                'params'=> array('null' => $lang['strbinarycompat']),
                        ),
                        'implicit' => array(
                                'title' => $lang['strimplicit'],
-                               'field' => 'castcontext',
+                               'field' => field('castcontext'),
                                'type'  => 'callback',
                                'params'=> array('function' => 'renderCastContext', 'align' => 'center'),
                        ),
index c9bc3706bab2f757a6d1ab3048f5aff1cfdde5d0..7ba9a21234d1e0acb743acbd695a09690f361a24 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.158 2007/07/19 19:51:17 xzilla Exp $
+        * $Id: Misc.php,v 1.159 2007/08/31 18:30:11 ioguix Exp $
         */
         
        class Misc {
                                                                break;
                                                        default:
                                                                echo "<td class=\"data{$id}\">";
-                                                               if (array_key_exists($column['field'], $tabledata->fields)) {
+                                                               $val = value($column['field'], $tabledata->fields);
+                                                               if (!is_null($val)) {
                                                                        if (isset($column['url'])) {
                                                                                echo "<a href=\"{$column['url']}";
-                                                                               if ($column['url'] === '') echo '?';
                                                                                $misc->printUrlVars($column['vars'], $tabledata->fields);
                                                                                echo "\">";
                                                                        }
-                                                               
                                                                        $type = isset($column['type']) ? $column['type'] : null;
                                                                        $params = isset($column['params']) ? $column['params'] : array();
-                                                                       echo $misc->printVal($tabledata->fields[$column['field']], $type, $params);
+                                                                       echo $misc->printVal($val, $type, $params);
+                                                                       if (isset($column['url'])) echo "</a>";
                                                                }
-                                                               
-                                                               if (isset($column['url'])) echo "</a>";
 
                                                                echo "</td>\n";
                                                                break;
index 36ce82e0207d21088d687c124f3719ee2e2cff2f..7b9903229cfc9756f6e7f1e7f1b4a50731c67fde 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.165 2007/07/20 04:38:34 xzilla Exp $
+ * $Id: Postgres73.php,v 1.166 2007/08/31 18:30:11 ioguix Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -1203,61 +1203,60 @@ class Postgres73 extends Postgres72 {
        // Constraint functions
 
        /**
-        * A function for getting all columns linked by foreign keys in a table
+        * Returns a list of all constraints on a table,
+        * including constraint name, definition, related col and referenced namespace,
+        * table and col if needed
         * @param $table the table where we are looking for fk
-        * @param $schema the table's schema
-        * @return a recordset of fk(s) infos
-        * return null if table hasn't fk
+        * @return a recordset
         */
-       function getForeignKeys($table, $schema) {
+       function getConstraints($table) {
                global $data;
 
                $data->clean($table);
-               $data->clean($schema);
        
-               // get the max number of col in a fk
-               $sql = "SELECT DISTINCT
-                               max(SUBSTRING(array_dims(c.conkey) FROM  '^\\\[.*:(.*)\\\]$')) as nb
-                       FROM
-                               pg_catalog.pg_constraint AS c,
-                               pg_catalog.pg_class AS r,
-                               pg_catalog.pg_namespace AS ns
-                       WHERE
-                               c.contype = 'f' AND c.conrelid = r.oid
-                               AND r.relname = '$table' AND r.relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='$schema')";
+               // get the max number of col used in a constraint for the table
+       $sql = "SELECT DISTINCT
+             max(SUBSTRING(array_dims(c.conkey) FROM  '^\\\[.*:(.*)\\\]$')) as nb
+       FROM
+             pg_catalog.pg_constraint AS c
+         JOIN pg_catalog.pg_class AS r ON (c.conrelid = r.oid)
+             JOIN pg_catalog.pg_namespace AS ns ON r.relnamespace=ns.oid
+       WHERE
+               r.relname = '$table' AND ns.nspname='". $this->_schema ."'";
 
                $rs = $this->selectSet($sql);
-               //if we got the max number of col, this table have fks...
-               if (!$rs->EOF) {
-                       $sql = "SELECT
-                               c.conname, ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema, r2.relname as f_table, pf.attname as p_field, ff.attname AS f_field
+
+           if ($rs->EOF) $max_col = 0;
+               else $max_col = $rs->fields['nb'];
+
+       $sql = '
+                       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
                        FROM
-                               pg_catalog.pg_constraint AS c,
-                               pg_catalog.pg_class AS r1,
-                         pg_catalog.pg_class AS r2,
-                               pg_catalog.pg_namespace AS ns1,
-                         pg_catalog.pg_namespace AS ns2,
-                               pg_catalog.pg_attribute AS pf,
-                         pg_catalog.pg_attribute AS ff
-                       WHERE
-                               c.contype='f'
-                               AND c.conrelid=r1.oid
-                               AND c.confrelid=r2.oid
-                               AND r1.relnamespace=ns1.oid
-                               AND r2.relnamespace=ns2.oid
-                               AND pf.attrelid=r1.oid
-                               AND ff.attrelid=r2.oid
-                               AND r1.relname = '$table' AND r1.relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='$schema')
-                               AND ((pf.attnum=conkey[1] AND ff.attnum=confkey[1])";
-
-                               for ($i = 2; $i <= $rs->fields['nb']; $i++) {
-                                       $sql.= " OR (pf.attnum=conkey[$i] AND ff.attnum=confkey[$i])";
-                               }
-                               $sql.= ")";
-
-                               return $this->selectSet($sql);
+                               pg_catalog.pg_constraint AS c
+                               JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid)
+                               JOIN pg_catalog.pg_attribute AS f1 ON (f1.attrelid=r1.oid AND (f1.attnum=c.conkey[1]';
+               for ($i = 2; $i <= $rs->fields['nb']; $i++) {
+                       $sql.= " OR f1.attnum=c.conkey[$i]";
                }
-               return null;
+               $sql.= '))
+                               JOIN pg_catalog.pg_namespace AS ns1 ON r1.relnamespace=ns1.oid
+                               LEFT JOIN (
+                                       pg_catalog.pg_class AS r2 JOIN pg_catalog.pg_namespace AS ns2 ON (r2.relnamespace=ns2.oid)
+                               ) ON (c.confrelid=r2.oid)
+                               LEFT JOIN pg_catalog.pg_attribute AS f2 ON 
+                                       (f2.attrelid=r2.oid AND ((c.confkey[1]=f2.attnum AND c.conkey[1]=f1.attnum)';
+               for ($i = 2; $i <= $rs->fields['nb']; $i++)
+                       $sql.= "OR (c.confkey[$i]=f2.attnum AND c.conkey[$i]=f1.attnum)";
+
+               $sql .= sprintf("))
+                       WHERE 
+                               r1.relname = '%s' AND ns1.nspname='%s'
+                       ORDER BY 1", $table, $this->_schema);
+
+               return $this->selectSet($sql);
        }
 
        /**
@@ -1340,67 +1339,6 @@ class Postgres73 extends Postgres72 {
                return $this->selectSet($sql);
         }
 
-       /**
-        * Returns a list of all constraints on a table
-        * @param $table The table to find rules for
-        * @return A recordset
-        */
-       function getConstraints($table) {
-               $this->clean($table);
-
-               /* This query finds all foreign key and check constraints in the pg_constraint
-                * table, and unions that with all indexes that are the basis for unique or
-                * primary key constraints. */
-               $sql = "
-                       SELECT conname, consrc, contype, indkey, indisclustered FROM (
-                               SELECT
-                                       conname,
-                                       CASE WHEN contype='f' THEN
-                                               pg_catalog.pg_get_constraintdef(oid)
-                                       ELSE
-                                               'CHECK (' || consrc || ')'
-                                       END AS consrc,
-                                       contype,
-                                       conrelid AS relid,
-                                       NULL AS indkey,
-                                       FALSE AS indisclustered
-                               FROM
-                                       pg_catalog.pg_constraint
-                               WHERE
-                                       contype IN ('f', 'c')
-                               UNION ALL
-                               SELECT
-                                       pc.relname,
-                                       NULL,
-                                       CASE WHEN indisprimary THEN
-                                               'p'
-                                       ELSE
-                                               'u'
-                                       END,
-                                       pi.indrelid,
-                                       indkey,
-                                       pi.indisclustered
-                               FROM
-                                       pg_catalog.pg_class pc,
-                                       pg_catalog.pg_index pi
-                               WHERE
-                                       pc.oid=pi.indexrelid
-                                       AND EXISTS (
-                                               SELECT 1 FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c
-                                               ON (d.refclassid = c.tableoid AND d.refobjid = c.oid)
-                                               WHERE d.classid = pc.tableoid AND d.objid = pc.oid AND d.deptype = 'i' AND c.contype IN ('u', 'p')
-                               )
-                       ) AS sub
-                       WHERE relid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}'
-                                       AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
-                                       WHERE nspname='{$this->_schema}'))
-                       ORDER BY
-                               1
-               ";
-
-               return $this->selectSet($sql);
-       }
-
        /**
         * Removes a constraint from a relation
         * @param $constraint The constraint to drop
index 83e469a0cce1268542e724ab206ec0dd6760a03e..872fa17aeeaf8169c09b8b9bdc7ccb09ed134366 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.57 2007/03/28 18:52:34 soranzo Exp $
+ * $Id: Postgres74.php,v 1.58 2007/08/31 18:30:11 ioguix Exp $
  */
 
 include_once('./classes/database/Postgres73.php');
@@ -255,50 +255,6 @@ class Postgres74 extends Postgres73 {
                return $this->selectSet($sql);
        }
 
-       // Constraint functions
-
-       /**
-        * Returns a list of all constraints on a table
-        * @param $table The table to find rules for
-        * @return A recordset
-        */
-       function getConstraints($table) {
-               $this->clean($table);
-
-               // This SQL is greatly complicated by the need to retrieve
-               // index clustering information for primary and unique constraints
-               $sql = "SELECT
-                               pc.conname,
-                               pg_catalog.pg_get_constraintdef(pc.oid, true) AS consrc,
-                               pc.contype,
-                               CASE WHEN pc.contype='u' OR pc.contype='p' THEN (
-                                       SELECT
-                                               indisclustered
-                                       FROM
-                                               pg_catalog.pg_depend pd,
-                                               pg_catalog.pg_class pl,
-                                               pg_catalog.pg_index pi
-                                       WHERE
-                                               pd.refclassid=pc.tableoid 
-                                               AND pd.refobjid=pc.oid
-                                               AND pd.objid=pl.oid
-                                               AND pl.oid=pi.indexrelid
-                               ) ELSE
-                                       NULL
-                               END AS indisclustered
-                       FROM
-                               pg_catalog.pg_constraint pc
-                       WHERE
-                               pc.conrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}'
-                                       AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
-                                       WHERE nspname='{$this->_schema}'))
-                       ORDER BY
-                               1
-               ";
-
-               return $this->selectSet($sql);
-       }
-
        // Administration functions
 
        /**
index 4c18d8fe36ee9199d2ed0e563f7a17679f5e3f66..ed7033fa5f9dfc7b0fbcf1399c30c99081a86512 100644 (file)
                        $column = array(
                                'column' => array(
                                        'title' => $lang['strcolumn'],
-                                       'field' => 'attname',
+                                       'field' => field('attname'),
                                ),
                                'type' => array(
                                        'title' => $lang['strtype'],
-                                       'field' => '+type',
+                                       'field' => field('+type'),
                                )
                        );
                
                        if ($isTable) {
                                $column['notnull'] = array(
                                        'title' => $lang['strnotnull'],
-                                       'field' => 'attnotnull',
+                                       'field' => field('attnotnull'),
                                        'type'  => 'bool',
                                        'params'=> array('true' => 'NOT NULL', 'false' => '')
                                );
                                $column['default'] = array(
                                        'title' => $lang['strdefault'],
-                                       'field' => 'adsrc'
+                                       'field' => field('adsrc'),
                                );
                        }
 
index 1496a4348b3bf260474d561c0752a1a6ea75a96a..8eea16c456059513f7f5bae6a2a7e4e0c05fd180 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List constraints on a table
         *
-        * $Id: constraints.php,v 1.51 2007/07/16 21:27:28 ioguix Exp $
+        * $Id: constraints.php,v 1.52 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'constraint' => array(
                                'title' => $lang['strname'],
-                               'field' => 'conname',
+                               'field' => field('conname'),
                        ),
                        'definition' => array(
                                'title' => $lang['strdefinition'],
-                               'field' => '+definition',
+                               'field' => field('+definition'),
                                'type'  => 'pre',
                        ),
                        'actions' => array(
index ea15a01d3f00545f3b284dbd189625b7e22a9d41..69525007c4d246b5d80c68831ac25ce2c5094aae 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage conversions in a database
         *
-        * $Id: conversions.php,v 1.14 2007/07/12 19:26:22 xzilla Exp $
+        * $Id: conversions.php,v 1.15 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'conversion' => array(
                                'title' => $lang['strname'],
-                               'field' => 'conname',
+                               'field' => field('conname'),
                        ),
                        'source_encoding' => array(
                                'title' => $lang['strsourceencoding'],
-                               'field' => 'conforencoding',
+                               'field' => field('conforencoding'),
                        ),
                        'target_encoding' => array(
                                'title' => $lang['strtargetencoding'],
-                               'field' => 'contoencoding',
+                               'field' => field('contoencoding'),
                        ),
                        'default' => array(
                                'title' => $lang['strdefault'],
-                               'field' => 'condefault',
+                               'field' => field('condefault'),
                                'type'  => 'yesno',
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'concomment',
+                               'field' => field('concomment'),
                        ),
                );
                
index bc0dbbc014594cf91b3d2b250adcbb6cbf3338cd..9d372008126e8d641005b8ab64d54cf0f3d8af5a 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.100 2007/07/16 21:27:28 ioguix Exp $
+        * $Id: database.php,v 1.101 2007/08/31 18:30:10 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'variable' => array(
                                'title' => $lang['strname'],
-                               'field' => 'name',
+                               'field' => field('name'),
                        ),
                        'value' => array(
                                'title' => $lang['strsetting'],
-                               'field' => 'setting',
+                               'field' => field('setting'),
                        ),
                );
                
                        $columns = array(
                                'transaction' => array(
                                        'title' => $lang['strxactid'],
-                                       'field' => 'transaction',
+                                       'field' => field('transaction'),
                                ),
                                'gid' => array(
                                        'title' => $lang['strgid'],
-                                       'field' => 'gid',
+                                       'field' => field('gid'),
                                ),
                                'prepared' => array(
                                        'title' => $lang['strstarttime'],
-                                       'field' => 'prepared',
+                                       'field' => field('prepared'),
                                ),
                                'owner' => array(
                                        'title' => $lang['strowner'],
-                                       'field' => 'owner',
+                                       'field' => field('owner'),
                                ),
                        );
 
                $columns = array(
                        'user' => array(
                                'title' => $lang['strusername'],
-                               'field' => 'usename',
+                               'field' => field('usename'),
                        ),
                        'process' => array(
                                'title' => $lang['strprocess'],
-                               'field' => 'procpid',
+                               'field' => field('procpid'),
                        ),
                        'query' => array(
                                'title' => $lang['strsql'],
-                               'field' => 'current_query',
+                               'field' => field('current_query'),
                        ),
                        'start_time' => array(
                                'title' => $lang['strstarttime'],
-                               'field' => 'query_start',
+                               'field' => field('query_start'),
                        ),
                );
 
                $columns = array(
                        'namespace' => array(
                                'title' => $lang['strschema'],
-                               'field' => 'nspname',
+                               'field' => field('nspname'),
                        ),
                        'tablename' => array(
                                'title' => $lang['strtablename'],
-                               'field' => 'tablename',
+                               'field' => field('tablename'),
                        ),
                        'transactionid' => array(
                                'title' => $lang['strtransaction'],
-                               'field' => 'transaction',
+                               'field' => field('transaction'),
                        ),
                        'processid' => array(
                                'title' => $lang['strprocessid'],
-                               'field' => 'pid',
+                               'field' => field('pid'),
                        ),
                        'mode' => array(
                                'title' => $lang['strmode'],
-                               'field' => 'mode',
+                               'field' => field('mode'),
                        ),
                        'granted' => array(
                                'title' => $lang['strislockheld'],
-                               'field' => 'granted',
+                               'field' => field('granted'),
                                'type'  => 'yesno',
                        ),
                );
                                        $columns = array(
                                                'namespace' => array(
                                                        'title' => $lang['strschema'],
-                                                       'field' => 'nspname',
+                                                       'field' => field('nspname'),
                                                ),      
                                                'relname' => array(
                                                        'title' => $lang['strtable'],
-                                                       'field' => 'relname',
+                                                       'field' => field('relname'),
                                                ),
                                                'enabled' => array(
                                                        'title' => $lang['strenabled'],
-                                                       'field' => 'enabled',
+                                                       'field' => field('enabled'),
                                                ),
                                                'vac_base_thresh' => array(
                                                        'title' => $lang['strvacuumbasethreshold'],
-                                                       'field' => 'vac_base_thresh',
+                                                       'field' => field('vac_base_thresh'),
                                                ),
                                                'vac_scale_factor' => array(
                                                        'title' => $lang['strvacuumscalefactor'],
-                                                       'field' => 'vac_scale_factor',
+                                                       'field' => field('vac_scale_factor'),
                                                ),
                                                'anl_base_thresh' => array(
                                                        'title' => $lang['stranalybasethreshold'],
-                                                       'field' => 'anl_base_thresh',
+                                                       'field' => field('anl_base_thresh'),
                                                ),
                                                'anl_scale_factor' => array(
                                                        'title' => $lang['stranalyzescalefactor'],
-                                                       'field' => 'anl_scale_factor',
+                                                       'field' => field('anl_scale_factor'),
                                                ),
                                                'vac_cost_delay' => array(
                                                        'title' => $lang['strvacuumcostdelay'],
-                                                       'field' => 'vac_cost_delay',
+                                                       'field' => field('vac_cost_delay'),
                                                ),
                                                'vac_cost_limit' => array(
                                                        'title' => $lang['strvacuumcostlimit'],
-                                                       'field' => 'vac_cost_limit',
+                                                       'field' => field('vac_cost_limit'),
                                                ),
                                        );
 
index 6a4ab9be0b8bbffed46a413b1c6f4eeddf643803..e73bb81705f5e02c02b851541604d67b7b5e4ebd 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage domains in a database
         *
-        * $Id: domains.php,v 1.32 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: domains.php,v 1.33 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'domain' => array(
                                'title' => $lang['strdomain'],
-                               'field' => 'domname',
+                               'field' => field('domname'),
                                'url' => "domains.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('domain' => 'domname'),
                        ),
                        'type' => array(
                                'title' => $lang['strtype'],
-                               'field' => 'domtype',
+                               'field' => field('domtype'),
                        ),
                        'notnull' => array(
                                'title' => $lang['strnotnull'],
-                               'field' => 'domnotnull',
+                               'field' => field('domnotnull'),
                                'type'  => 'bool',
                                'params'=> array('true' => 'NOT NULL', 'false' => ''),
                        ),
                        'default' => array(
                                'title' => $lang['strdefault'],
-                               'field' => 'domdef',
+                               'field' => field('domdef'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'domowner',
+                               'field' => field('domowner'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'domcomment',
+                               'field' => field('domcomment'),
                        ),
                );
                
index 5a66285cb0cac79ea4b214186ed9aa1129096340..59a9b1e7156480f6983d07cfae342d159093ddb8 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage functions in a database
         *
-        * $Id: functions.php,v 1.66 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: functions.php,v 1.67 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'function' => array(
                                'title' => $lang['strfunction'],
-                               'field' => 'proproto',
+                               'field' => field('proproto'),
                                'type'  => 'verbatim',
                                'url'   => "redirect.php?subject=function&amp;action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('function' => 'proproto', 'function_oid' => 'prooid'),
                        ),
                        'returns' => array(
                                'title' => $lang['strreturns'],
-                               'field' => 'proreturns',
+                               'field' => field('proreturns'),
                                'type'  => 'verbatim',
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'proowner',
+                               'field' => field('proowner'),
                        ),
                        'proglanguage' => array(
                                'title' => $lang['strproglanguage'],
-                               'field' => 'prolanguage',
+                               'field' => field('prolanguage'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'procomment',
+                               'field' => field('procomment'),
                        ),
                );
                
index 6bb2af1a8465578f18c8e12b1caedd31f8379c27..a0c52b4b73ab97f874f98a95910ba24228120a53 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage groups in a database cluster
         *
-        * $Id: groups.php,v 1.26 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: groups.php,v 1.27 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'group' => array(
                                'title' => $lang['strgroup'],
-                               'field' => 'groname',
+                               'field' => field('groname'),
                                'url'   => "groups.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('group' => 'groname'),
                        ),
index 8bdd4d509d5a99c1c04eaf08969a125f02bdc93e..db8c10e8b306505ea3008b7760ef2dea0b45df11 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List indexes on a table
         *
-        * $Id: indexes.php,v 1.43 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: indexes.php,v 1.44 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'index' => array(
                                'title' => $lang['strname'],
-                               'field' => 'indname',
+                               'field' => field('indname'),
                        ),
                        'definition' => array(
                                'title' => $lang['strdefinition'],
-                               'field' => 'inddef',
+                               'field' => field('inddef'),
                        ),
                        'constraints' => array(
                                'title' => $lang['strconstraints'],
-                               'field' => '+constraints',
+                               'field' => field('+constraints'),
                                'type'  => 'verbatim',
                                'params'=> array('align' => 'center'),
                        ),
                        'clustered' => array(
                                'title' => $lang['strclustered'],
-                               'field' => 'indisclustered',
+                               'field' => field('indisclustered'),
                                'type'  => 'yesno',
                        ),
                        'actions' => array(
index 9ec051cbbcabc4e6a1678cce4c8200d3450b00f2..6ce806fd3b729466ea5698439cfac884bc3e38a9 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage languages in a database
         *
-        * $Id: languages.php,v 1.12 2007/07/12 19:26:22 xzilla Exp $
+        * $Id: languages.php,v 1.13 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'language' => array(
                                'title' => $lang['strname'],
-                               'field' => 'lanname',
+                               'field' => field('lanname'),
                        ),
                        'trusted' => array(
                                'title' => $lang['strtrusted'],
-                               'field' => 'lanpltrusted',
+                               'field' => field('lanpltrusted'),
                                'type'  => 'yesno',
                        ),
                        'function' => array(
                                'title' => $lang['strfunction'],
-                               'field' => 'lanplcallf',
+                               'field' => field('lanplcallf'),
                        ),
                );
 
index 58f0062abd3612015d5bd2e357fbf6e329461958..24c0bbdd9e7da75a37650bbd1abe1579786ec6a2 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage opclasss in a database
         *
-        * $Id: opclasses.php,v 1.9 2005/11/25 08:49:08 jollytoad Exp $
+        * $Id: opclasses.php,v 1.10 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'accessmethod' => array(
                                'title' => $lang['straccessmethod'],
-                               'field' => 'amname',
+                               'field' => field('amname'),
                        ),
                        'opclass' => array(
                                'title' => $lang['strname'],
-                               'field' => 'opcname',
+                               'field' => field('opcname'),
                        ),
                        'type' => array(
                                'title' => $lang['strtype'],
-                               'field' => 'opcintype',
+                               'field' => field('opcintype'),
                        ),
                        'default' => array(
                                'title' => $lang['strdefault'],
-                               'field' => 'opcdefault',
+                               'field' => field('opcdefault'),
                                'type'  => 'yesno',
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'opccomment',
+                               'field' => field('opccomment'),
                        ),
                );
                
index 0953cf2119040b55f9caebbaed7ff1db0aeec31c..0426b782ba6547c8f71b8cc42989f81b37666187 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage operators in a database
         *
-        * $Id: operators.php,v 1.28 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: operators.php,v 1.29 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'operator' => array(
                                'title' => $lang['stroperator'],
-                               'field' => 'oprname',
+                               'field' => field('oprname'),
                                'url'   => "operators.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('operator' => 'oprname', 'operator_oid' => 'oid'),
                        ),
                        'leftarg' => array(
                                'title' => $lang['strleftarg'],
-                               'field' => 'oprleftname',
+                               'field' => field('oprleftname'),
                        ),
                        'rightarg' => array(
                                'title' => $lang['strrightarg'],
-                               'field' => 'oprrightname',
+                               'field' => field('oprrightname'),
                        ),
                        'returns' => array(
                                'title' => $lang['strreturns'],
-                               'field' => 'resultname',
+                               'field' => field('resultname'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'oprcomment',
+                               'field' => field('oprcomment'),
                        ),
                );
 
index 707b279695f2e23bd93522acb0548078f84a7987..b3d0972ae7570b3792a66633ee7f83d596b3a37c 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Slony database tab plugin
         *
-        * $Id: plugin_slony.php,v 1.22 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: plugin_slony.php,v 1.23 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'no_name' => array(
                                'title' => $lang['strcluster'],
-                               'field' => 'cluster',
+                               'field' => field('cluster'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=cluster_properties&amp;",
                                'vars'  => array('slony_cluster' => 'cluster'),
                        ),
                        ),
                        'no_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'comment',
+                               'field' => field('comment'),
                        )
                );
                
                $columns = array(
                        'no_name' => array(
                                'title' => $lang['strname'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=node_properties&amp;subject=slony_node&amp;",
                                'vars'  => array('no_id' => 'no_id', 'no_name' => 'no_comment'),
                        ),
                        'no_status' => array(
                                'title' => $lang['strstatus'],
-                               'field' => 'no_status',
+                               'field' => field('no_status'),
                                'type' => 'slonystatus',
                        ),
                        'actions' => array(
                        ),
                        'no_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                        )
                );
                
                $columns = array(
                        'no_name' => array(
                                'title' => $lang['strname'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=path_properties&amp;",
                                'vars'  => array('no_id' => 'pa_client', 'path_id' => 'no_id'),
                        ),
                        ),
                        'no_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                        )
                );
                
                $columns = array(
                        'no_name' => array(
                                'title' => $lang['strname'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=listen_properties&amp;",
                                'vars'  => array('no_id' => 'li_receiver', 'listen_id' => 'no_id', 'origin_id' => 'li_origin'),
                        ),
                        ),
                        'no_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                        )
                );
                
                $columns = array(
                        'set_name' => array(
                                'title' => $lang['strname'],
-                               'field' => 'set_comment',
+                               'field' => field('set_comment'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=set_properties&amp;",
                                'vars'  => array('set_id' => 'set_id'),
                        ),
                        ),
                        'set_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'set_comment',
+                               'field' => field('set_comment'),
                        )
                );
                
                $columns = array(
                        'table' => array(
                                'title' => $lang['strtable'],
-                               'field' => 'qualname',
+                               'field' => field('qualname'),
                                'url'   => "redirect.php?subject=table&amp;{$misc->href}&amp;",
                                'vars'  => array('table' => 'relname', 'schema' => 'nspname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'relowner',
+                               'field' => field('relowner'),
                        ),
                        'tablespace' => array(
                                'title' => $lang['strtablespace'],
-                               'field' => 'tablespace',
+                               'field' => field('tablespace'),
                        ),
                        'tuples' => array(
                                'title' => $lang['strestimatedrowcount'],
-                               'field' => 'reltuples',
+                               'field' => field('reltuples'),
                                'type'  => 'numeric',
                        ),
                        'actions' => array(
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'relcomment',
+                               'field' => field('relcomment'),
                        ),
                );
                
                $columns = array(
                        'sequence' => array(
                                'title' => $lang['strsequence'],
-                               'field' => 'qualname',
+                               'field' => field('qualname'),
                                'url'   => "sequences.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('sequence' => 'seqname', 'schema' => 'nspname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'seqowner',
+                               'field' => field('seqowner'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'seqcomment',
+                               'field' => field('seqcomment'),
                        ),
                );
                
                $columns = array(
                        'no_name' => array(
                                'title' => $lang['strname'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                                'url'   => "plugin_slony.php?{$misc->href}&amp;action=subscription_properties&amp;",
                                'vars'  => array('set_id' => 'sub_set', 'no_id' => 'no_id'),
                        ),
                        'no_comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'no_comment',
+                               'field' => field('no_comment'),
                        )
                );
                
index b397e25c7be07474c3455bc3bb24ccc2e18dff2c..899f547c5f4682884af3784edeb33951f0d80b53 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List reports in a database
         *
-        * $Id: reports.php,v 1.31 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: reports.php,v 1.32 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'report' => array(
                                'title' => $lang['strreport'],
-                               'field' => 'report_name',
+                               'field' => field('report_name'),
                                'url'   => "reports.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('report_id' => 'report_id'),
                        ),
                        'database' => array(
                                'title' => $lang['strdatabase'],
-                               'field' => 'db_name',
+                               'field' => field('db_name'),
                        ),
                        'created' => array(
                                'title' => $lang['strcreated'],
-                               'field' => 'date_created',
+                               'field' => field('date_created'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'descr',
+                               'field' => field('descr'),
                        ),
                );
                
index 8944b019be1362435efe0813c48a0422e9e3ed65..b3d83911f3cc658eb2dcc0cfba73a6364efc305d 100644 (file)
--- a/roles.php
+++ b/roles.php
@@ -3,7 +3,7 @@
        /**
         * Manage roles in a database cluster
         *
-        * $Id: roles.php,v 1.9 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: roles.php,v 1.10 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'role' => array(
                                'title' => $lang['strrole'],
-                               'field' => 'rolname',
+                               'field' => field('rolname'),
                                'url'   => "redirect.php?subject=role&amp;action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('rolename' => 'rolname'),
                        ),
                        'superuser' => array(
                                'title' => $lang['strsuper'],
-                               'field' => 'rolsuper',
+                               'field' => field('rolsuper'),
                                'type'  => 'yesno',
                        ),
                        'createdb' => array(
                                'title' => $lang['strcreatedb'],
-                               'field' => 'rolcreatedb',
+                               'field' => field('rolcreatedb'),
                                'type'  => 'yesno',
                        ),
                        'createrole' => array(
                                'title' => $lang['strcancreaterole'],
-                               'field' => 'rolcreaterole',
+                               'field' => field('rolcreaterole'),
                                'type'  => 'yesno',
                        ),
                        'inherits' => array(
                                'title' => $lang['strinheritsprivs'],
-                               'field' => 'rolinherit',
+                               'field' => field('rolinherit'),
                                'type'  => 'yesno',
                        ),
                        'canloging' => array(
                                'title' => $lang['strcanlogin'],
-                               'field' => 'rolcanlogin',
+                               'field' => field('rolcanlogin'),
                                'type'  => 'yesno',
                        ),
                        'connlimit' => array(
                                'title' => $lang['strconnlimit'],
-                               'field' => 'rolconnlimit',
+                               'field' => field('rolconnlimit'),
                                'type'  => 'callback',
                                'params'=> array('function' => 'renderRoleConnLimit')
                        ),
                        'expires' => array(
                                'title' => $lang['strexpires'],
-                               'field' => 'rolvaliduntil',
+                               'field' => field('rolvaliduntil'),
                                'type'  => 'callback',
                                'params'=> array('function' => 'renderRoleExpires', 'null' => $lang['strnever']),
                        ),
index c0225f9528c821c63fb4fdcae8f56fa338bab76f..cd0b15bd2d99f1d89e11df3c9dfa1de7e35e066b 100644 (file)
--- a/rules.php
+++ b/rules.php
@@ -3,7 +3,7 @@
        /**
         * List rules on a table OR view
         *
-        * $Id: rules.php,v 1.32 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: rules.php,v 1.33 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'rule' => array(
                                'title' => $lang['strname'],
-                               'field' => 'rulename',
+                               'field' => field('rulename'),
                        ),
                        'definition' => array(
                                'title' => $lang['strdefinition'],
-                               'field' => 'definition',
+                               'field' => field('definition'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
index 90a987f194e776247d6a199b57de4aaf90aeaa23..44b8a823d53659e30151d4085cea436c464ed216 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas in a database
         *
-        * $Id: schemas.php,v 1.18 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: schemas.php,v 1.19 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                        $columns = array(
                                'schema' => array(
                                        'title' => $lang['strschema'],
-                                       'field' => 'nspname',
+                                       'field' => field('nspname'),
                                        'url'   => "redirect.php?subject=schema&amp;{$misc->href}&amp;",
                                        'vars'  => array('schema' => 'nspname'),
                                ),
                                'owner' => array(
                                        'title' => $lang['strowner'],
-                                       'field' => 'nspowner',
+                                       'field' => field('nspowner'),
                                ),
                                'actions' => array(
                                        'title' => $lang['stractions'],
                                ),
                                'comment' => array(
                                        'title' => $lang['strcomment'],
-                                       'field' => 'nspcomment',
+                                       'field' => field('nspcomment'),
                                ),
                        );
                        
index 257d4dd75e4872b11e33c1c48b316f94df50e544..f7f2107b2650cb5290f07dc21018c2a7f6ee55ed 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage sequences in a database
         *
-        * $Id: sequences.php,v 1.42 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: sequences.php,v 1.43 2007/08/31 18:30:11 ioguix Exp $
         */
        
        // Include application functions
                $columns = array(
                        'sequence' => array(
                                'title' => $lang['strsequence'],
-                               'field' => 'seqname',
+                               'field' => field('seqname'),
                                'url'   => "sequences.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('sequence' => 'seqname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'seqowner',
+                               'field' => field('seqowner'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'seqcomment',
+                               'field' => field('seqcomment'),
                        ),
                );
                
index 81420cddbb943fbc3321debe36c5f536dbee129e..e0c9ce1f502f24f371cb66e902eaca14abb8822c 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage servers
         *
-        * $Id: servers.php,v 1.10 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: servers.php,v 1.11 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'server' => array(
                                'title' => $lang['strserver'],
-                               'field' => 'desc',
+                               'field' => field('desc'),
                                'url'   => "redirect.php?subject=server&amp;",
                                'vars'  => array('server' => 'id'),
                        ),
                        'host' => array(
                                'title' => $lang['strhost'],
-                               'field' => 'host',
+                               'field' => field('host'),
                        ),
                        'port' => array(
                                'title' => $lang['strport'],
-                               'field' => 'port',
+                               'field' => field('port'),
                        ),
                        'username' => array(
                                'title' => $lang['strusername'],
-                               'field' => 'username',
+                               'field' => field('username'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
index 221c8a0fcf0ffbaebb166269e62ce77d79df7382..31d8db685f75fa45f1ae3013824172fe40ad3d9d 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.100 2007/07/17 14:59:52 ioguix Exp $
+        * $Id: tables.php,v 1.101 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'table' => array(
                                'title' => $lang['strtable'],
-                               'field' => 'relname',
+                               'field' => field('relname'),
                                'url'           => "redirect.php?subject=table&amp;{$misc->href}&amp;",
                                'vars'  => array('table' => 'relname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'relowner',
+                               'field' => field('relowner'),
                        ),
                        'tablespace' => array(
                                'title' => $lang['strtablespace'],
-                               'field' => 'tablespace'
+                               'field' => field('tablespace')
                        ),
                        'tuples' => array(
                                'title' => $lang['strestimatedrowcount'],
-                               'field' => 'reltuples',
+                               'field' => field('reltuples'),
                                'type'  => 'numeric'
                        ),
                        'actions' => array(
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'relcomment',
+                               'field' => field('relcomment'),
                        ),
                );
                
index a65a69476379cf49bbe2f144cd0b141378f3a83f..5e2ffb78a7fe6c8fed9206e20147075ac2461816 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage tablespaces in a database cluster
         *
-        * $Id: tablespaces.php,v 1.15 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: tablespaces.php,v 1.16 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'database' => array(
                                'title' => $lang['strname'],
-                               'field' => 'spcname'
+                               'field' => field('spcname')
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'spcowner'
+                               'field' => field('spcowner')
                        ),
                        'location' => array(
                                'title' => $lang['strlocation'],
-                               'field' => 'spclocation'
+                               'field' => field('spclocation')
                        ),
                        'actions' => array(
                                'title' => $lang['stractions']
                if ($data->hasSharedComments()) {
                        $columns['comment'] = array(
                                'title' => $lang['strcomment'],
-                               'field' => 'spccomment',
+                               'field' => field('spccomment'),
                        );
                }
 
index b95048a423c6e41d5782e00ef63915aecb18c310..6252f7e432fcfff80a2685aec8e651e8e6e00deb 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tblproperties.php,v 1.83 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: tblproperties.php,v 1.84 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                function attPre(&$rowdata, $actions) {
                        global $data;
                        $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
-                       $actions['browse']['url'] .= "query=" . urlencode("SELECT \"{$rowdata->fields['attname']}\", count(*) AS \"count\" FROM \"{$_REQUEST['table']}\" GROUP BY \"{$rowdata->fields['attname']}\" ORDER BY \"{$rowdata->fields['attname']}\"") . '&amp;';
+                       $actions['browse']['url'] .= 'query=' . urlencode("SELECT \"{$rowdata->fields['attname']}\", count(*) AS \"count\" FROM \"{$_REQUEST['table']}\" GROUP BY \"{$rowdata->fields['attname']}\" ORDER BY \"{$rowdata->fields['attname']}\"") . '&amp;';
                        return $actions;
                }
-               
+
                $misc->printTrail('table');
                $misc->printTabs('table','columns');
                $misc->printMsg($msg);
                $tdata = $data->getTable($_REQUEST['table']);
                // Get columns
                $attrs = $data->getTableAttributes($_REQUEST['table']);
+               // Get Pk & Constraints
+               $ck = $data->getConstraints($_REQUEST['table']);
 
                // Show comment if any
                if ($tdata->fields['relcomment'] !== null)
-                       echo "<p class=\"comment\">", $misc->printVal($tdata->fields['relcomment']), "</p>\n";
+                       echo '<p class="comment">', $misc->printVal($tdata->fields['relcomment']), "</p>\n";
 
                $columns = array(
                        'column' => array(
                                'title' => $lang['strcolumn'],
-                               'field' => 'attname',
+                               'field' => field('attname'),
                                'url'   => "colproperties.php?subject=column&amp;{$misc->href}&amp;table=".urlencode($_REQUEST['table'])."&amp;",
                                'vars'  => array('column' => 'attname'),
                        ),
                        'type' => array(
                                'title' => $lang['strtype'],
-                               'field' => '+type',
+                               'field' => field('+type'),
                        ),
                        'notnull' => array(
                                'title' => $lang['strnotnull'],
-                               'field' => 'attnotnull',
+                               'field' => field('attnotnull'),
                                'type'  => 'bool',
                                'params'=> array('true' => 'NOT NULL', 'false' => ''),
                        ),
                        'default' => array(
                                'title' => $lang['strdefault'],
-                               'field' => 'adsrc',
+                               'field' => field('adsrc'),
+                       ),
+                       'keyprop' => array(
+                               'title' => $lang['strconstraints'],
+                               'field' => field('attname'),
+                               'type'  => 'callback',
+                               'params'=> array(
+                                       'function' => 'cstrRender',
+                                       'keys' => $ck->getArray()
+                               ),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'comment',
+                               'field' => field('comment'),
                        ),
                );
+               if (!$data->hasForeignKeysInfo()) {
+                       unset($columns['keyprop']);
+               }
+               else {
+                       function cstrRender($s, $p) {
+                               global $misc;
+
+                               $str ='';
+                               foreach ($p['keys'] as $c)
+                                       if ($c['p_field'] == $s)
+                                               switch ($c['contype']) {
+                                                       case 'p':
+                                                           $str .= '<a href="constraints.php?'. $misc->href ."&amp;table={$c['p_table']}&amp;schema={$c['p_schema']}\"><img src=\"".
+                                                                       $misc->icon('PrimaryKey') .'" alt="[pk]" title="'. htmlentities($c['consrc']) .'" /></a>';
+                                                       break;
+                                                       case 'f':
+                                                               $str .= '<a href="tblproperties.php?'. $misc->href ."&amp;table={$c['f_table']}&amp;schema={$c['f_schema']}\"><img src=\"".
+                                                                       $misc->icon('ForeignKey') .'" alt="[fk]" title="'. htmlentities($c['consrc']) .'" /></a>';
+                                                       break;
+                                                       case 'u':
+                                                               $str .= '<a href="constraints.php?'. $misc->href ."&amp;table={$c['p_table']}&amp;schema={$c['p_schema']}\"><img src=\"".
+                                                                       $misc->icon('UniqueConstraint') .'" alt="[uniq]" title="'. htmlentities($c['consrc']) .'" /></a>';
+                                                       break;
+                                                       case 'c':
+                                                               $str .= '<a href="constraints.php?'. $misc->href ."&amp;table={$c['p_table']}&amp;schema={$c['p_schema']}\"><img src=\"".
+                                                                       $misc->icon('CheckConstraint') .'" alt="[check]" title="'. htmlentities($c['consrc']) .'" /></a>';
+                                               }
+
+                               return $str;
+                       }
+               }
                
                $return_url = urlencode("tblproperties.php?{$misc->href}&amp;table={$_REQUEST['table']}");
 
index 035b9433e5b5b938a9b30722cba33c75879c4d2e..5c0ddd96e7aa2f811f03cc20c1ca0c16627510d7 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List triggers on a table
         *
-        * $Id: triggers.php,v 1.35 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: triggers.php,v 1.36 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'trigger' => array(
                                'title' => $lang['strname'],
-                               'field' => 'tgname',
+                               'field' => field('tgname'),
                        ),
                        'definition' => array(
                                'title' => $lang['strdefinition'],
-                               'field' => '+tgdef',
+                               'field' => field('+tgdef'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
index 765f9fb1c3547ee1fcb8b9696fb26e916d73dbd2..b8957d881d4f0539b06f37b2b7ab469269126ade 100644 (file)
--- a/types.php
+++ b/types.php
@@ -3,7 +3,7 @@
        /**
         * Manage types in a database
         *
-        * $Id: types.php,v 1.38 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: types.php,v 1.39 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                                $columns = array(
                                        'field' => array(
                                                'title' => $lang['strfield'],
-                                               'field' => 'attname',
+                                               'field' => field('attname'),
                                        ),
                                        'type' => array(
                                                'title' => $lang['strtype'],
-                                               'field' => '+type',
+                                               'field' => field('+type'),
                                        ),
                                        'comment' => array(
                                                'title' => $lang['strcomment'],
-                                               'field' => 'comment',
+                                               'field' => field('comment'),
                                        )
                                );
                                
                $columns = array(
                        'type' => array(
                                'title' => $lang['strtype'],
-                               'field' => 'typname',
+                               'field' => field('typname'),
                                'url'   => "types.php?action=properties&amp;{$misc->href}&amp;",
                                'vars'  => array('type' => 'basename'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'typowner',
+                               'field' => field('typowner'),
                        ),
                        'flavour' => array(
                                'title' => $lang['strflavor'],
-                               'field' => 'typtype',
+                               'field' => field('typtype'),
                                'type'  => 'verbatim',
                                'params'=> array(
                                        'map' => array(
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'typcomment',
+                               'field' => field('typcomment'),
                        ),
                );
                
index f1c5c7583c682d0baf557502e916d49c7e715e0a..99b3da37ee5aad25eeaeeb9d7d5cbbc85c1f79c6 100644 (file)
--- a/users.php
+++ b/users.php
@@ -3,7 +3,7 @@
        /**
         * Manage users in a database cluster
         *
-        * $Id: users.php,v 1.38 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: users.php,v 1.39 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'user' => array(
                                'title' => $lang['strusername'],
-                               'field' => 'usename',
+                               'field' => field('usename'),
                        ),
                        'superuser' => array(
                                'title' => $lang['strsuper'],
-                               'field' => 'usesuper',
+                               'field' => field('usesuper'),
                                'type'  => 'yesno',
                        ),
                        'createdb' => array(
                                'title' => $lang['strcreatedb'],
-                               'field' => 'usecreatedb',
+                               'field' => field('usecreatedb'),
                                'type'  => 'yesno',
                        ),
                        'expires' => array(
                                'title' => $lang['strexpires'],
-                               'field' => 'useexpires',
+                               'field' => field('useexpires'),
                                'type'  => 'callback',
                                'params'=> array('function' => 'renderUseExpires', 'null' => $lang['strnever']),
                        ),
                        'defaults' => array(
                                'title' => $lang['strsessiondefaults'],
-                               'field' => 'useconfig',
+                               'field' => field('useconfig'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
index 803aeadc8d80fee5620d1283d17ed7e2c47a14f6..b7bdc98cc98bb96c0b8acdbade654934b1bae639 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * List views in a database
         *
-        * $Id: viewproperties.php,v 1.30 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: viewproperties.php,v 1.31 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'column' => array(
                                'title' => $lang['strcolumn'],
-                               'field' => 'attname',
+                               'field' => field('attname'),
                        ),
                        'type' => array(
                                'title' => $lang['strtype'],
-                               'field' => '+type',
+                               'field' => field('+type'),
                        ),
                        'default' => array(
                                'title' => $lang['strdefault'],
-                               'field' => 'adsrc',
+                               'field' => field('adsrc'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'comment',
+                               'field' => field('comment'),
                        ),
                );
                
index 15dcdfb951c0d29fb4a8e305579710157a95884f..8689b51e5edd51cf6dd1fa2eec00a34ab777b49c 100644 (file)
--- a/views.php
+++ b/views.php
@@ -3,7 +3,7 @@
        /**
         * Manage views in a database
         *
-        * $Id: views.php,v 1.72 2007/07/16 21:27:29 ioguix Exp $
+        * $Id: views.php,v 1.73 2007/08/31 18:30:11 ioguix Exp $
         */
 
        // Include application functions
                $columns = array(
                        'view' => array(
                                'title' => $lang['strview'],
-                               'field' => 'relname',
+                               'field' => field('relname'),
                                'url' => "redirect.php?subject=view&amp;{$misc->href}&amp;",
                                'vars'  => array('view' => 'relname'),
                        ),
                        'owner' => array(
                                'title' => $lang['strowner'],
-                               'field' => 'relowner',
+                               'field' => field('relowner'),
                        ),
                        'actions' => array(
                                'title' => $lang['stractions'],
                        ),
                        'comment' => array(
                                'title' => $lang['strcomment'],
-                               'field' => 'relcomment',
+                               'field' => field('relcomment'),
                        ),
                );