summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorioguix2007-08-31 18:30:10 +0000
committerioguix2007-08-31 18:30:10 +0000
commitb782b46ecb0353e45a34b2f8a0582b6ed2fb952b (patch)
tree7e9d3f1097cb4af93630fa751454b4324eb984ed
parent236fddef4f03fff3f9e220f23b1974bb8ba9428a (diff)
Add a constraints column in the tblproperties field page for pg 7.3+
-rw-r--r--aggregates.php12
-rw-r--r--all_db.php14
-rw-r--r--casts.php10
-rw-r--r--classes/Misc.php12
-rw-r--r--classes/database/Postgres73.php152
-rw-r--r--classes/database/Postgres74.php46
-rw-r--r--colproperties.php8
-rw-r--r--constraints.php6
-rw-r--r--conversions.php12
-rwxr-xr-xdatabase.php52
-rw-r--r--domains.php14
-rw-r--r--functions.php12
-rw-r--r--groups.php4
-rw-r--r--indexes.php10
-rw-r--r--languages.php8
-rw-r--r--opclasses.php12
-rw-r--r--operators.php12
-rwxr-xr-xplugin_slony.php44
-rw-r--r--reports.php10
-rw-r--r--roles.php18
-rw-r--r--rules.php6
-rwxr-xr-xschemas.php8
-rw-r--r--sequences.php8
-rw-r--r--servers.php10
-rw-r--r--tables.php12
-rwxr-xr-xtablespaces.php10
-rw-r--r--tblproperties.php60
-rw-r--r--triggers.php6
-rw-r--r--types.php16
-rw-r--r--users.php12
-rwxr-xr-xviewproperties.php10
-rw-r--r--views.php8
32 files changed, 284 insertions, 350 deletions
diff --git a/aggregates.php b/aggregates.php
index ddc3b1d6..3e19bc26 100644
--- a/aggregates.php
+++ b/aggregates.php
@@ -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
@@ -272,28 +272,28 @@
$columns = array(
'aggrname' => array(
'title' => $lang['strname'],
- 'field' => 'proname',
+ 'field' => field('proname'),
'url' => "redirect.php?subject=aggregate&action=properties&{$misc->href}&",
'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'),
),
);
diff --git a/all_db.php b/all_db.php
index 449a140d..c8262f73 100644
--- a/all_db.php
+++ b/all_db.php
@@ -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
@@ -308,25 +308,25 @@
$columns = array(
'database' => array(
'title' => $lang['strdatabase'],
- 'field' => 'datname',
+ 'field' => field('datname'),
'url' => "redirect.php?subject=database&{$misc->href}&",
'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(
@@ -334,7 +334,7 @@
),
'comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'datcomment',
+ 'field' => field('datcomment'),
),
);
diff --git a/casts.php b/casts.php
index 523235aa..7e2a587d 100644
--- 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
@@ -37,20 +37,20 @@
$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'),
),
diff --git a/classes/Misc.php b/classes/Misc.php
index c9bc3706..7ba9a212 100644
--- a/classes/Misc.php
+++ b/classes/Misc.php
@@ -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 {
@@ -1645,20 +1645,18 @@
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;
diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php
index 36ce82e0..7b990322 100644
--- a/classes/database/Postgres73.php
+++ b/classes/database/Postgres73.php
@@ -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);
}
/**
@@ -1341,67 +1340,6 @@ class Postgres73 extends Postgres72 {
}
/**
- * 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
* @param $relation The relation from which to drop
diff --git a/classes/database/Postgres74.php b/classes/database/Postgres74.php
index 83e469a0..872fa17a 100644
--- a/classes/database/Postgres74.php
+++ b/classes/database/Postgres74.php
@@ -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
/**
diff --git a/colproperties.php b/colproperties.php
index 4c18d8fe..ed7033fa 100644
--- a/colproperties.php
+++ b/colproperties.php
@@ -211,24 +211,24 @@
$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'),
);
}
diff --git a/constraints.php b/constraints.php
index 1496a434..8eea16c4 100644
--- a/constraints.php
+++ b/constraints.php
@@ -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
@@ -452,11 +452,11 @@
$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(
diff --git a/conversions.php b/conversions.php
index ea15a01d..69525007 100644
--- a/conversions.php
+++ b/conversions.php
@@ -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
@@ -28,24 +28,24 @@
$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'),
),
);
diff --git a/database.php b/database.php
index bc0dbbc0..9d372008 100755
--- a/database.php
+++ b/database.php
@@ -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
@@ -392,11 +392,11 @@
$columns = array(
'variable' => array(
'title' => $lang['strname'],
- 'field' => 'name',
+ 'field' => field('name'),
),
'value' => array(
'title' => $lang['strsetting'],
- 'field' => 'setting',
+ 'field' => field('setting'),
),
);
@@ -425,19 +425,19 @@
$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'),
),
);
@@ -453,19 +453,19 @@
$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'),
),
);
@@ -504,27 +504,27 @@
$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',
),
);
@@ -646,39 +646,39 @@
$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'),
),
);
diff --git a/domains.php b/domains.php
index 6a4ab9be..e73bb817 100644
--- a/domains.php
+++ b/domains.php
@@ -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
@@ -376,34 +376,34 @@
$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'),
),
);
diff --git a/functions.php b/functions.php
index 5a66285c..59a9b1e7 100644
--- a/functions.php
+++ b/functions.php
@@ -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
@@ -629,30 +629,30 @@
$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'),
),
);
diff --git a/groups.php b/groups.php
index 6bb2af1a..a0c52b4b 100644
--- a/groups.php
+++ b/groups.php
@@ -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
@@ -218,7 +218,7 @@
$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'),
),
diff --git a/indexes.php b/indexes.php
index 8bdd4d50..db8c10e8 100644
--- a/indexes.php
+++ b/indexes.php
@@ -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
@@ -263,21 +263,21 @@
$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(
diff --git a/languages.php b/languages.php
index 9ec051cb..6ce806fd 100644
--- a/languages.php
+++ b/languages.php
@@ -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
@@ -28,16 +28,16 @@
$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'),
),
);
diff --git a/opclasses.php b/opclasses.php
index 58f0062a..24c0bbdd 100644
--- a/opclasses.php
+++ b/opclasses.php
@@ -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
@@ -28,24 +28,24 @@
$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'),
),
);
diff --git a/operators.php b/operators.php
index 0953cf21..0426b782 100644
--- a/operators.php
+++ b/operators.php
@@ -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
@@ -114,28 +114,28 @@
$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'),
),
);
diff --git a/plugin_slony.php b/plugin_slony.php
index 707b2796..b3d0972a 100755
--- a/plugin_slony.php
+++ b/plugin_slony.php
@@ -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
@@ -433,7 +433,7 @@
$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'),
),
@@ -442,7 +442,7 @@
),
'no_comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'comment',
+ 'field' => field('comment'),
)
);
@@ -597,13 +597,13 @@
$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(
@@ -611,7 +611,7 @@
),
'no_comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'no_comment',
+ 'field' => field('no_comment'),
)
);
@@ -753,7 +753,7 @@
$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'),
),
@@ -762,7 +762,7 @@
),
'no_comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'no_comment',
+ 'field' => field('no_comment'),
)
);
@@ -927,7 +927,7 @@
$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'),
),
@@ -936,7 +936,7 @@
),
'no_comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'no_comment',
+ 'field' => field('no_comment'),
)
);
@@ -1096,7 +1096,7 @@
$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'),
),
@@ -1105,7 +1105,7 @@
),
'set_comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'set_comment',
+ 'field' => field('set_comment'),
)
);
@@ -1495,21 +1495,21 @@
$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(
@@ -1517,7 +1517,7 @@
),
'comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'relcomment',
+ 'field' => field('relcomment'),
),
);
@@ -1776,20 +1776,20 @@
$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'),
),
);
@@ -1979,13 +1979,13 @@
$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'),
)
);
diff --git a/reports.php b/reports.php
index b397e25c..899f547c 100644
--- a/reports.php
+++ b/reports.php
@@ -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
@@ -248,24 +248,24 @@
$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'),
),
);
diff --git a/roles.php b/roles.php
index 8944b019..b3d83911 100644
--- 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
@@ -557,44 +557,44 @@
$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']),
),
diff --git a/rules.php b/rules.php
index c0225f95..cd0b15bd 100644
--- 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
@@ -136,11 +136,11 @@
$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'],
diff --git a/schemas.php b/schemas.php
index 90a987f1..44b8a823 100755
--- a/schemas.php
+++ b/schemas.php
@@ -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
@@ -30,20 +30,20 @@
$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'),
),
);
diff --git a/sequences.php b/sequences.php
index 257d4dd7..f7f2107b 100644
--- a/sequences.php
+++ b/sequences.php
@@ -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
@@ -29,20 +29,20 @@
$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'),
),
);
diff --git a/servers.php b/servers.php
index 81420cdd..e0c9ce1f 100644
--- a/servers.php
+++ b/servers.php
@@ -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
@@ -40,21 +40,21 @@
$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'],
diff --git a/tables.php b/tables.php
index 221c8a0f..31d8db68 100644
--- a/tables.php
+++ b/tables.php
@@ -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
@@ -780,21 +780,21 @@
$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(
@@ -802,7 +802,7 @@
),
'comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'relcomment',
+ 'field' => field('relcomment'),
),
);
diff --git a/tablespaces.php b/tablespaces.php
index a65a6947..5e2ffb78 100755
--- a/tablespaces.php
+++ b/tablespaces.php
@@ -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
@@ -212,15 +212,15 @@
$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']
@@ -230,7 +230,7 @@
if ($data->hasSharedComments()) {
$columns['comment'] = array(
'title' => $lang['strcomment'],
- 'field' => 'spccomment',
+ 'field' => field('spccomment'),
);
}
diff --git a/tblproperties.php b/tblproperties.php
index b95048a4..6252f7e4 100644
--- a/tblproperties.php
+++ b/tblproperties.php
@@ -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
@@ -425,10 +425,10 @@
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);
@@ -437,40 +437,82 @@
$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']}");
diff --git a/triggers.php b/triggers.php
index 035b9433..5c0ddd96 100644
--- a/triggers.php
+++ b/triggers.php
@@ -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
@@ -281,11 +281,11 @@
$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'],
diff --git a/types.php b/types.php
index 765f9fb1..b8957d88 100644
--- 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
@@ -39,15 +39,15 @@
$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'),
)
);
@@ -404,17 +404,17 @@
$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(
@@ -431,7 +431,7 @@
),
'comment' => array(
'title' => $lang['strcomment'],
- 'field' => 'typcomment',
+ 'field' => field('typcomment'),
),
);
diff --git a/users.php b/users.php
index f1c5c758..99b3da37 100644
--- 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
@@ -288,27 +288,27 @@
$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'],
diff --git a/viewproperties.php b/viewproperties.php
index 803aeadc..b7bdc98c 100755
--- a/viewproperties.php
+++ b/viewproperties.php
@@ -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
@@ -310,22 +310,22 @@
$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'),
),
);
diff --git a/views.php b/views.php
index 15dcdfb9..8689b51e 100644
--- 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
@@ -547,20 +547,20 @@
$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'),
),
);