/**
* Manage aggregates in a database
*
- * $Id: aggregates.php,v 1.26 2007/11/30 15:17:22 soranzo Exp $
+ * $Id: aggregates.php,v 1.27 2008/01/19 13:46:15 ioguix Exp $
*/
// Include application functions
echo "\t<td class=\"data1\">", htmlspecialchars($aggrdata->fields['aggfinalfn']), "</td>\n</tr>\n";
echo "<tr>\n\t<th class=\"data left\">{$lang['straggrinitcond']}</th>\n";
echo "\t<td class=\"data1\">", htmlspecialchars($aggrdata->fields['agginitval']), "</td>\n</tr>\n";
- echo "<tr>\n\t<th class=\"data left\">{$lang['straggrsortop']}</th>\n";
- echo "\t<td class=\"data1\">", htmlspecialchars($aggrdata->fields['aggsortop']), "</td>\n</tr>\n";
+ if($data->hasAggregateSortOp()) {
+ echo "<tr>\n\t<th class=\"data left\">{$lang['straggrsortop']}</th>\n";
+ echo "\t<td class=\"data1\">", htmlspecialchars($aggrdata->fields['aggsortop']), "</td>\n</tr>\n";
+ }
echo "<tr>\n\t<th class=\"data left\">{$lang['strowner']}</th>\n";
echo "\t<td class=\"data1\">", htmlspecialchars($aggrdata->fields['usename']), "</td>\n</tr>\n";
echo "<tr>\n\t<th class=\"data left\">{$lang['strcomment']}</th>\n";
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.318 2007/12/12 04:11:10 xzilla Exp $
+ * $Id: Postgres.php,v 1.319 2008/01/19 13:46:15 ioguix Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->selectSet($sql);
}
+ /**
+ * Gets all information for an aggregate
+ * @param $name The name of the aggregate
+ * @param $basetype The input data type of the aggregate
+ * @return A recordset
+ */
+ function getAggregate($name, $basetype) {
+ $this->fieldclean($name);
+ $this->fieldclean($basetype);
+
+ $sql = "
+ SELECT a.aggname AS proname,
+ CASE a.aggbasetype
+ WHEN 0 THEN NULL
+ ELSE format_type(a.aggbasetype, NULL)
+ END AS proargtypes,
+ a.aggtransfn, format_type(a.aggtranstype, NULL) AS aggstype, a.aggfinalfn, a.agginitval, u.usename,
+ obj_description(a.oid, 'pg_aggregate') AS aggrcomment
+ FROM pg_user u, pg_aggregate a
+ WHERE a.aggowner=u.usesysid
+ AND a.aggname='" . $name . "'
+ AND CASE a.aggbasetype
+ WHEN 0 THEN ''
+ ELSE format_type(a.aggbasetype, NULL)
+ END ='" . $basetype . "'";
+
+ return $this->selectSet($sql);
+ }
+
/**
* Creates a new aggregate in the database
* @param $name The name of the aggregate
function hasPreparedXacts() { return false; }
function hasDisableTriggers() { return false; }
function hasAlterAggregate() { return false; }
+ function hasAggregateSortOp() { return false; }
function hasSharedComments() {return false;}
function hasAnalyze() {return false;}
function hasCreateTableLike() {return false;}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.185 2007/12/28 16:21:25 ioguix Exp $
+ * $Id: Postgres73.php,v 1.186 2008/01/19 13:46:15 ioguix Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
$this->fieldclean($name);
$this->fieldclean($basetype);
- $sql = "SELECT p.proname, CASE p.proargtypes[0] WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN NULL ELSE
- pg_catalog.format_type(p.proargtypes[0], NULL) END AS proargtypes, a.aggtransfn,
- format_type(a.aggtranstype, NULL) AS aggstype, a.aggfinalfn, a.agginitval, a.aggsortop, u.usename,
- pg_catalog.obj_description(p.oid, 'pg_proc') AS aggrcomment
- FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n, pg_catalog.pg_user u, pg_catalog.pg_aggregate a
- WHERE n.oid = p.pronamespace AND p.proowner=u.usesysid AND p.oid=a.aggfnoid
- AND p.proisagg AND n.nspname='{$this->_schema}'
- AND p.proname='" . $name . "' AND CASE p.proargtypes[0] WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype
- THEN NULL ELSE pg_catalog.format_type(p.proargtypes[0], NULL) END ='" . $basetype . "'";
+ $sql = "
+ SELECT p.proname,
+ CASE p.proargtypes[0]
+ WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN NULL
+ ELSE pg_catalog.format_type(p.proargtypes[0], NULL)
+ END AS proargtypes, a.aggtransfn, format_type(a.aggtranstype, NULL) AS aggstype,
+ a.aggfinalfn, a.agginitval, u.usename, pg_catalog.obj_description(p.oid, 'pg_proc') AS aggrcomment
+ FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n, pg_catalog.pg_user u, pg_catalog.pg_aggregate a
+ WHERE n.oid = p.pronamespace AND p.proowner=u.usesysid AND p.oid=a.aggfnoid
+ AND p.proisagg AND n.nspname='{$this->_schema}'
+ AND p.proname='" . $name . "'
+ AND CASE p.proargtypes[0]
+ WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN ''
+ ELSE pg_catalog.format_type(p.proargtypes[0], NULL)
+ END ='" . $basetype . "'";
return $this->selectSet($sql);
}
/**
* PostgreSQL 8.1 support
*
- * $Id: Postgres81.php,v 1.20 2007/12/12 10:45:35 ioguix Exp $
+ * $Id: Postgres81.php,v 1.21 2008/01/19 13:46:15 ioguix Exp $
*/
include_once('./classes/database/Postgres80.php');
return 0;
}
+ // Aggregate functions
+
+ /**
+ * Gets all information for an aggregate
+ * @param $name The name of the aggregate
+ * @param $basetype The input data type of the aggregate
+ * @return A recordset
+ */
+ function getAggregate($name, $basetype) {
+ $this->fieldclean($name);
+ $this->fieldclean($basetype);
+
+ $sql = "
+ SELECT p.proname, CASE p.proargtypes[0]
+ WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN NULL
+ ELSE pg_catalog.format_type(p.proargtypes[0], NULL) END AS proargtypes,
+ a.aggtransfn, format_type(a.aggtranstype, NULL) AS aggstype, a.aggfinalfn,
+ a.agginitval, a.aggsortop, u.usename, pg_catalog.obj_description(p.oid, 'pg_proc') AS aggrcomment
+ FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n, pg_catalog.pg_user u, pg_catalog.pg_aggregate a
+ WHERE n.oid = p.pronamespace AND p.proowner=u.usesysid AND p.oid=a.aggfnoid
+ AND p.proisagg AND n.nspname='{$this->_schema}'
+ AND p.proname='" . $name . "'
+ AND CASE p.proargtypes[0]
+ WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN ''
+ ELSE pg_catalog.format_type(p.proargtypes[0], NULL)
+ END ='" . $basetype . "'";
+
+ return $this->selectSet($sql);
+ }
+
// Capabilities
function hasServerAdminFuncs() { return true; }
function hasRoles() { return true; }
function hasFunctionAlterSchema() { return true; }
function hasAlterTableSchema() { return true; }
function hasSequenceAlterSchema() { return true; }
+ function hasAggregateSortOp() { return true; }
}
?>
/**
* List tables in a database
*
- * $Id: tblproperties.php,v 1.91 2007/12/28 16:21:25 ioguix Exp $
+ * $Id: tblproperties.php,v 1.92 2008/01/19 13:46:15 ioguix Exp $
*/
// Include application functions
$tdata = $data->getTable($_REQUEST['table']);
// Get columns
$attrs = $data->getTableAttributes($_REQUEST['table']);
- // Get Pk & Constraints
- $ck = $data->getConstraintsWithFields($_REQUEST['table']);
// Show comment if any
if ($tdata->fields['relcomment'] !== null)
'title' => $lang['strdefault'],
'field' => field('adsrc'),
),
- 'keyprop' => array(
- 'title' => $lang['strconstraints'],
- 'field' => field('attname'),
- 'type' => 'callback',
- 'params'=> array(
- 'function' => 'cstrRender',
- 'keys' => $ck->getArray()
- ),
- ),
+ 'keyprop' => 1,
'actions' => array(
'title' => $lang['stractions'],
),
'field' => field('comment'),
),
);
+
if (!$data->hasConstraintsInfo()) {
unset($columns['keyprop']);
}
else {
+ $ck = $data->getConstraintsWithFields($_REQUEST['table']);
+
+ $columns['keyprop'] = array(
+ 'title' => $lang['strconstraints'],
+ 'field' => field('attname'),
+ 'type' => 'callback',
+ 'params'=> array(
+ 'function' => 'cstrRender',
+ 'keys' => $ck->getArray()
+ ),
+ );
+
function cstrRender($s, $p) {
global $misc, $data;