(eg. constraints can only be btree indexes)
re-enable help system
all DROP and ALTER commands MUST be fully schema-qualified otherwise you can accidentally drop stuff in pg_catalog :(
-need icons for Casts and Conversions and Languages
+need icons for Casts and Conversions, Languages, Aggs and OpClasses
submit changes to HTML_TreeMenu maintainer
test < 7.3 Find feature for all new objects
fix constraint search to get domain and table constraints?
Need to fix:
* Variables and processes views for < 7.3
-* Viewing database properties is broken...
+* Add aggregates and opclasses to Find feature
+* Aggregate and opclass support for < 7.3
\ No newline at end of file
* Large speed improvements by reducing number of database
connections and using external style sheet.
* SQL pop-up window now defaults to the current database
+* Display aggregates and operator classes
Bugs
* Object browser fixed for databases with no schemas
--- /dev/null
+<?php
+
+ /**
+ * Manage aggregates in a database
+ *
+ * $Id: aggregates.php,v 1.1 2003/12/24 11:12:20 chriskl Exp $
+ */
+
+ // Include application functions
+ include_once('./libraries/lib.inc.php');
+
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+ if (!isset($msg)) $msg = '';
+
+ /**
+ * Show default list of aggregates in the database
+ */
+ function doDefault($msg = '') {
+ global $data, $misc;
+ global $lang;
+
+ echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['straggregates']}</h2>\n";
+ $misc->printMsg($msg);
+
+ $aggregates = &$data->getAggregates();
+
+ if ($aggregates->recordCount() > 0) {
+ echo "<table>\n";
+ echo "<tr><th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strtype']}</th>";
+ echo "</tr>\n";
+ $i = 0;
+ while (!$aggregates->EOF) {
+ $id = (($i % 2) == 0 ? '1' : '2');
+ echo "<tr><td class=\"data{$id}\">", $misc->printVal($aggregates->f['proname']), "</td>\n";
+ echo "<td class=\"data{$id}\">";
+ // If arg type is NULL, then we need to output "all types"
+ if ($aggregates->f['proargtypes'] === null)
+ echo $lang['stralltypes'];
+ else
+ echo $misc->printVal($aggregates->f['proargtypes']);
+ echo "</td>\n";
+ echo "</tr>\n";
+ $aggregates->moveNext();
+ $i++;
+ }
+ echo "</table>\n";
+ }
+ else {
+ echo "<p>{$lang['strnoaggregates']}</p>\n";
+ }
+ }
+
+ $misc->printHeader($lang['straggregates']);
+ $misc->printBody();
+
+ switch ($action) {
+ default:
+ doDefault();
+ break;
+ }
+
+ $misc->printFooter();
+
+?>
* if you click on a database it shows a list of database objects in that
* database.
*
- * $Id: browser.php,v 1.33 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: browser.php,v 1.34 2003/12/24 11:12:20 chriskl Exp $
*/
// Include application functions
}
// Advanced
if ($conf['show_advanced']) {
- if ($data->hasTypes() || $data->hasOperators() || $data->hasConversions()) {
+ if ($data->hasTypes() || $data->hasOperators() || $data->hasConversions()
+ || $data->hasAggregates() || $data->hasOpClasses()) {
$adv_node = &new HTML_TreeNode(array(
'text' => $lang['stradvanced'],
'link' => ($data->hasSchemas()) ? addslashes(htmlspecialchars("schema.php?{$querystr}&" . SID)) : null,
// Add folder to schema
$schemanode->addItem($adv_node);
}
+ // Aggregates
+ if ($data->hasAggregates()) {
+ $agg_node = &new HTML_TreeNode(array(
+ 'text' => addslashes($lang['straggregates']),
+ 'link' => addslashes(htmlspecialchars("aggregates.php?{$querystr}")),
+ 'icon' => "../../../images/themes/{$conf['theme']}/types.png",
+ 'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
+ 'expanded' => false,
+ 'linkTarget' => 'detail'));
+
+ // Add folder to schema
+ $adv_node->addItem($agg_node);
+ }
// Types
if ($data->hasTypes()) {
$type_node = &new HTML_TreeNode(array(
// Add folder to schema
$adv_node->addItem($opr_node);
}
+ // Operator Classes
+ if ($data->hasOpClasses()) {
+ $opc_node = &new HTML_TreeNode(array(
+ 'text' => addslashes($lang['stropclasses']),
+ 'link' => addslashes(htmlspecialchars("opclasses.php?{$querystr}")),
+ 'icon' => "../../../images/themes/{$conf['theme']}/operators.png",
+ 'expandedIcon' => "../../../images/themes/{$conf['theme']}/operators.png",
+ 'expanded' => false,
+ 'linkTarget' => 'detail'));
+
+ // Add folder to schema
+ $adv_node->addItem($opc_node);
+ }
// Conversions
if ($data->hasConversions()) {
$con_node = &new HTML_TreeNode(array(
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: BaseDB.php,v 1.36 2003/12/19 05:53:19 chriskl Exp $
+ * $Id: BaseDB.php,v 1.37 2003/12/24 11:12:20 chriskl Exp $
*/
include_once('./classes/database/ADODB_base.php');
function hasPartialIndexes() { return false; }
function hasCasts() { return false; }
function hasFullSubqueries() { return false; }
-
+ function hasPrepare() { return false; }
+ function hasOpClasses() { return false; }
}
?>
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.168 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: Postgres.php,v 1.169 2003/12/24 11:12:20 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->selectSet($sql);
}
-
+
// Type conversion routines
/**
function hasLanguages() { return true; }
function hasDropColumn() { return false; }
function hasSRFs() { return true; }
-
+ function hasOpClasses() { return true; }
}
?>
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.83 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: Postgres73.php,v 1.84 2003/12/24 11:12:20 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
*/
function &getConversions() {
$sql = "
- SELECT\r
- c.conname,\r
- pg_catalog.pg_encoding_to_char(c.conforencoding) AS conforencoding,\r
+ SELECT
+ c.conname,
+ pg_catalog.pg_encoding_to_char(c.conforencoding) AS conforencoding,
pg_catalog.pg_encoding_to_char(c.contoencoding) AS contoencoding,
- c.condefault\r
- FROM pg_catalog.pg_conversion c, pg_catalog.pg_namespace n\r
- WHERE n.oid = c.connamespace\r
- AND n.nspname='{$this->_schema}'\r
- ORDER BY 1;\r
+ c.condefault
+ FROM pg_catalog.pg_conversion c, pg_catalog.pg_namespace n
+ WHERE n.oid = c.connamespace
+ AND n.nspname='{$this->_schema}'
+ ORDER BY 1;
";
return $this->selectSet($sql);
";
return $this->selectSet($sql);
- }
+ }
+
+ // Aggregate functions
+
+ /**
+ * Gets all aggregates
+ * @return A recordset
+ */
+ function &getAggregates() {
+ $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
+ FROM pg_catalog.pg_proc p
+ LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
+ WHERE
+ p.proisagg
+ AND n.nspname='{$this->_schema}'
+ ORDER BY 1, 2
+ ";
+
+ return $this->selectSet($sql);
+ }
+
+ // Operator Class functions
+
+ /**
+ * Gets all opclasses
+ * @return A recordset
+ */
+ function &getOpClasses() {
+ $sql = "
+ SELECT
+ pa.amname, po.opcname, po.opcintype::pg_catalog.regtype AS opcintype, po.opcdefault
+ FROM
+ pg_catalog.pg_opclass po, pg_catalog.pg_am pa, pg_catalog.pg_namespace pn
+ WHERE
+ po.opcamid=pa.oid
+ AND po.opcnamespace=pn.oid
+ AND pn.nspname='{$this->_schema}'
+ ORDER BY 1,2
+ ";
+
+ return $this->selectSet($sql);
+ }
// Capabilities
function hasSchemas() { return true; }
function hasDomains() { return true; }
function hasAlterTrigger() { return true; }
function hasCasts() { return true; }
+ function hasPrepare() { return true; }
}
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.123 2003/12/16 00:32:28 soranzo Exp $
+ * $Id: english.php,v 1.124 2003/12/24 11:12:20 chriskl Exp $
*/
// Language and character set
$lang['strprocess'] = 'Process';
$lang['strprocesses'] = 'Processes';
$lang['strsetting'] = 'Setting';
+ $lang['strparameters'] = 'Parameters';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
$lang['strreferringtables'] = 'Referring tables';
$lang['strparenttables'] = 'Parent tables';
$lang['strchildtables'] = 'Child tables';
+
+ // Aggregates
+ $lang['straggregates'] = 'Aggregates';
+ $lang['strnoaggregates'] = 'No aggregates found.';
+ $lang['stralltypes'] = '(All types)';
+
+ // Operator Classes
+ $lang['stropclasses'] = 'Op Classes';
+ $lang['strnoopclasses'] = 'No operator classes found.';
+ $lang['straccessmethod'] = 'Access method';
// Miscellaneous
$lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.75 2003/12/16 00:32:28 soranzo Exp $
+ * $Id: english.php,v 1.76 2003/12/24 11:12:21 chriskl Exp $
*/
// Language and character set
$lang['strprocess'] = 'Process';
$lang['strprocesses'] = 'Processes';
$lang['strsetting'] = 'Setting';
+ $lang['strparameters'] = 'Parameters';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
$lang['strreferringtables'] = 'Referring tables';
$lang['strparenttables'] = 'Parent tables';
$lang['strchildtables'] = 'Child tables';
+
+ // Aggregates
+ $lang['straggregates'] = 'Aggregates';
+ $lang['strnoaggregates'] = 'No aggregates found.';
+ $lang['stralltypes'] = '(All types)';
+
+ // Operator Classes
+ $lang['stropclasses'] = 'Op Classes';
+ $lang['strnoopclasses'] = 'No operator classes found.';
+ $lang['straccessmethod'] = 'Access method';
// Miscellaneous
$lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
--- /dev/null
+<?php
+
+ /**
+ * Manage opclasss in a database
+ *
+ * $Id: opclasses.php,v 1.1 2003/12/24 11:12:20 chriskl Exp $
+ */
+
+ // Include application functions
+ include_once('./libraries/lib.inc.php');
+
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+ if (!isset($msg)) $msg = '';
+
+ /**
+ * Show default list of opclasss in the database
+ */
+ function doDefault($msg = '') {
+ global $data, $misc;
+ global $lang;
+
+ echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['stropclasses']}</h2>\n";
+ $misc->printMsg($msg);
+
+ $opclasses = &$data->getOpClasses();
+
+ if ($opclasses->recordCount() > 0) {
+ echo "<table><tr>\n";
+ echo "<th class=\"data\">{$lang['straccessmethod']}</th>";
+ echo "<th class=\"data\">{$lang['strname']}</th>";
+ echo "<th class=\"data\">{$lang['strtype']}</th>";
+ echo "<th class=\"data\">{$lang['strdefault']}</th>";
+ echo "</tr>\n";
+ $i = 0;
+ while (!$opclasses->EOF) {
+ $opclasses->f['opcdefault'] = $data->phpBool($opclasses->f['opcdefault']);
+ $id = (($i % 2) == 0 ? '1' : '2');
+ echo "<tr><td class=\"data{$id}\">", $misc->printVal($opclasses->f['amname']), "</td>\n";
+ echo "<td class=\"data{$id}\">", $misc->printVal($opclasses->f['opcname']), "</td>\n";
+ echo "<td class=\"data{$id}\">", $misc->printVal($opclasses->f['opcintype']), "</td>\n";
+ echo "<td class=\"data{$id}\">", (($opclasses->f['opcdefault']) ? $lang['stryes'] : $lang['strno']), "</td>\n";
+ echo "</tr>\n";
+ $opclasses->moveNext();
+ $i++;
+ }
+ echo "</table>\n";
+ }
+ else {
+ echo "<p>{$lang['strnoopclasses']}</p>\n";
+ }
+ }
+
+ $misc->printHeader($lang['stropclasses']);
+ $misc->printBody();
+
+ switch ($action) {
+ default:
+ doDefault();
+ break;
+ }
+
+ $misc->printFooter();
+
+?>
/**
* Display properties of a schema
*
- * $Id: schema.php,v 1.12 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: schema.php,v 1.13 2003/12/24 11:12:20 chriskl Exp $
*/
// Include application functions (no db conn)
if ($conf['show_advanced']) {
echo "<li>{$lang['stradvanced']}</li>\n";
echo "<ul>\n";
+ echo "<li><a href=\"aggregates.php?{$misc->href}\">{$lang['straggregates']}</a></li>\n";
echo "<li><a href=\"types.php?{$misc->href}\">{$lang['strtypes']}</a></li>\n";
echo "<li><a href=\"operators.php?{$misc->href}\">{$lang['stroperators']}</a></li>\n";
+ echo "<li><a href=\"opclasses.php?{$misc->href}\">{$lang['stropclasses']}</a></li>\n";
echo "<li><a href=\"conversions.php?{$misc->href}\">{$lang['strconversions']}</a></li>\n";
echo "</ul>\n";
}