From 7cc11c915850fadf8ff7f91d763b726d06ca7867 Mon Sep 17 00:00:00 2001 From: chriskl Date: Mon, 27 Oct 2003 03:49:19 +0000 Subject: [PATCH] show conversions support --- BUGS | 1 + HISTORY | 4 ++- TODO | 15 +++++++---- browser.php | 17 ++++++++++-- classes/database/Postgres73.php | 48 ++++++++++++++++----------------- lang/english.php | 8 +++++- lang/recoded/english.php | 8 +++++- 7 files changed, 67 insertions(+), 34 deletions(-) diff --git a/BUGS b/BUGS index 9cce2a27..652adc9d 100644 --- a/BUGS +++ b/BUGS @@ -3,4 +3,5 @@ fix getIndexes() and getConstraints() for < 7.3 to know about index type (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 diff --git a/HISTORY b/HISTORY index 0232dbf4..42992cf1 100644 --- a/HISTORY +++ b/HISTORY @@ -6,15 +6,17 @@ Version 3.2-dev Features * Option to dump table structure, data or structure and data +* Set datestyle and extra_float_digits when dumping data * Extra login security to prevent logging into servers as postgres and no password - a VERY common newbie error. * Cluster indexes and indexed constraints (with analyze) * Display clustered status of indexes and indexed constraints -* Set datestyle and extra_float_digits when dumping data * Table info - shows table that reference the table, parent tables, and child tables. * Choice of operator when performing a Select * Removed any trace of MySQL support +* Show casts +* Show conversions Bugs * Added legal DOCTYPE diff --git a/TODO b/TODO index 58e77793..51d529fe 100644 --- a/TODO +++ b/TODO @@ -75,8 +75,8 @@ Types Operators --------- -* Properties -* Drop +* -Properties (chriskl) +* -Drop (chriskl) * Create Operator Classes @@ -107,13 +107,18 @@ Domains (7.3) Conversions (7.3) ----------------- -* Some functions implemented in 73 -* No interface done +* -Display (chriskl) +* Properties +* Drop +* Create Casts (7.3) ----------- -* Unimplemented +* -Display (chriskl) +* Properties +* Drop +* Create Settings -------- diff --git a/browser.php b/browser.php index 527b93fa..21f6f2c8 100644 --- a/browser.php +++ b/browser.php @@ -5,7 +5,7 @@ * if you click on a database it shows a list of database objects in that * database. * - * $Id: browser.php,v 1.20 2003/10/26 12:12:28 chriskl Exp $ + * $Id: browser.php,v 1.21 2003/10/27 03:49:19 chriskl Exp $ */ // Include application functions @@ -124,7 +124,7 @@ $schemanode->addItem($dom_node); } // Advanced - if ($data->hasTypes() || $data->hasOperators()) { + if ($data->hasTypes() || $data->hasOperators() || $data->hasConversions()) { $adv_node = &new HTML_TreeNode(array( 'text' => $lang['stradvanced'], 'link' => addslashes(htmlspecialchars("schema.php?{$querystr}&" . SID)), @@ -161,6 +161,19 @@ // Add folder to schema $adv_node->addItem($opr_node); } + // Conversions + if ($data->hasConversions()) { + $con_node = &new HTML_TreeNode(array( + 'text' => addslashes($lang['strconversions']), + 'link' => addslashes(htmlspecialchars("conversions.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($con_node); + } } $databases = &$data->getDatabases(); diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php index fee1bf1f..c366ee16 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.73 2003/10/26 12:12:28 chriskl Exp $ + * $Id: Postgres73.php,v 1.74 2003/10/27 03:49:19 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -151,29 +151,6 @@ class Postgres73 extends Postgres72 { return $this->execute($sql); } - - // Conversions functions - - /** - * Return all conversions in the current database - * @return All conversions, sorted alphabetically - */ - function &getConversions() { - $sql = "SELECT conname, conowner FROM pg_catalog.pg_conversion ORDER BY conname"; - - return $this->selectSet($sql); - } - - /** - * Return all information relating to a conversion - * @param $conversion The name of the conversion - * @return Conversion information - */ - function &getConversionByName($conversion) { - $this->clean($conversion); - $sql = "SELECT * FROM pg_catalog.pg_conversion WHERE conname='{$conversion}'"; - return $this->selectRow($sql); - } // Table functions @@ -1272,6 +1249,7 @@ class Postgres73 extends Postgres72 { */ function &getCasts() { + // @@ TRANSLATION PROBLEM HERE $sql = " SELECT castsource::pg_catalog.regtype AS castsource, @@ -1290,6 +1268,28 @@ class Postgres73 extends Postgres72 { return $this->selectSet($sql); } + + // Conversion functions + + /** + * Returns a list of all conversions in the database + * @return All conversions + */ + function &getConversions() { + $sql = " + 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 + 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); + } // Capabilities function hasSchemas() { return true; } diff --git a/lang/english.php b/lang/english.php index d6832304..6e11b951 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.117 2003/10/26 12:12:28 chriskl Exp $ + * $Id: english.php,v 1.118 2003/10/27 03:49:19 chriskl Exp $ */ // Language and character set @@ -515,6 +515,12 @@ $lang['strtargettype'] = 'Target type'; $lang['strimplicit'] = 'Implicit'; + // Conversions + $lang['strconversions'] = 'Conversions'; + $lang['strnoconversions'] = 'No conversions found.'; + $lang['strsourceencoding'] = 'Source encoding'; + $lang['strtargetencoding'] = 'Target encoding'; + // Info $lang['strnoinfo'] = 'No information available.'; $lang['strreferringtables'] = 'Referring tables'; diff --git a/lang/recoded/english.php b/lang/recoded/english.php index ec63f397..8058b785 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.69 2003/10/26 12:12:29 chriskl Exp $ + * $Id: english.php,v 1.70 2003/10/27 03:49:20 chriskl Exp $ */ // Language and character set @@ -515,6 +515,12 @@ $lang['strtargettype'] = 'Target type'; $lang['strimplicit'] = 'Implicit'; + // Conversions + $lang['strconversions'] = 'Conversions'; + $lang['strnoconversions'] = 'No conversions found.'; + $lang['strsourceencoding'] = 'Source encoding'; + $lang['strtargetencoding'] = 'Target encoding'; + // Info $lang['strnoinfo'] = 'No information available.'; $lang['strreferringtables'] = 'Referring tables'; -- 2.39.5