fix listing of domains in appropriate places
authorchriskl <chriskl>
Mon, 28 Jun 2004 02:26:56 +0000 (02:26 +0000)
committerchriskl <chriskl>
Mon, 28 Jun 2004 02:26:56 +0000 (02:26 +0000)
HISTORY
classes/database/Postgres.php
classes/database/Postgres72.php
classes/database/Postgres73.php
functions.php
tables.php
tblproperties.php

diff --git a/HISTORY b/HISTORY
index c49db3444622aded79a99b61840e0aa38cacf52b..b879ded9232b9d49107ea2a8d46645dae60aeaa7 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -21,6 +21,7 @@ Bugs
 * Fix table export problems pre 7.3
 * Fix join clause created by view wizard for pre 7.3
 * Fix reindex of mixed case indexes
+* Show domains in type lists in appropriate places
 
 Version 3.4
 -----------
index cbd86e683fa6e77340b3e11e0ab2bd31fab8e444..8d347c1462191a7a69beab916cb2e453bd6f042c 100755 (executable)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres.php,v 1.226 2004/06/28 01:22:58 chriskl Exp $
+ * $Id: Postgres.php,v 1.227 2004/06/28 02:26:57 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -2789,9 +2789,11 @@ class Postgres extends BaseDB {
        /**
         * Returns a list of all types in the database
         * @param $all If true, will find all available functions, if false just those in search path
+        * @param $tabletypes If true, will include table types
+        * @param $domains Ignored
         * @return A recordet
         */
-       function &getTypes($all = false, $tabletypes = false) {
+       function &getTypes($all = false, $tabletypes = false, $domains = false) {
                global $conf;
                
                if ($all || $conf['show_system']) {
@@ -2802,10 +2804,10 @@ class Postgres extends BaseDB {
                // Never show system table types
                $where2 = "AND c.oid > '{$this->_lastSystemOID}'::oid";
 
+               // Create type filter
+               $tqry = "'c'";
                if ($tabletypes)
-                       $tqry = "'c', 'r', 'v'";
-               else
-                       $tqry = "'c'";
+                       $tqry .= ", 'r', 'v'";
 
                $sql = "SELECT
                                pt.typname AS basename,
index aef5b8a5405b5758bd96121b122eb13a90efabcf..280f9b8891fed65f34160a1f0b762ce9b3634fd4 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres72.php,v 1.70 2004/06/11 05:08:26 xzilla Exp $
+ * $Id: Postgres72.php,v 1.71 2004/06/28 02:26:57 chriskl Exp $
  */
 
 
@@ -383,9 +383,11 @@ class Postgres72 extends Postgres71 {
        /**
         * Returns a list of all types in the database
         * @param $all If true, will find all available functions, if false just those in search path
+        * @param $tabletypes If true, will include table types
+        * @param $domains Ignored
         * @return A recordet
         */
-       function &getTypes($all = false, $tabletypes = false) {
+       function &getTypes($all = false, $tabletypes = false, $domains = false) {
                global $conf;
                
                if ($all || $conf['show_system']) {
@@ -396,10 +398,10 @@ class Postgres72 extends Postgres71 {
                // Never show system table types
                $where2 = "AND c.oid > '{$this->_lastSystemOID}'::oid";
                
+               // Create type filter
+               $tqry = "'c'";
                if ($tabletypes)
-                       $tqry = "'c', 'r', 'v'";
-               else
-                       $tqry = "'c'";
+                       $tqry .= ", 'r', 'v'";
                
                $sql = "SELECT
                                pt.typname AS basename,
index a4881e2d7a3f9763ca4ca4899e6fc209c3353712..2694a4af7d4aeae5444471c9fff370312e3897cb 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.121 2004/06/11 05:08:27 xzilla Exp $
+ * $Id: Postgres73.php,v 1.122 2004/06/28 02:26:57 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -844,10 +844,11 @@ class Postgres73 extends Postgres72 {
        /**
         * Returns a list of all types in the database
         * @param $all If true, will find all available functions, if false just those in search path
-        * @param $tabletypes If true, will include table types, false will not.
+        * @param $tabletypes If true, will include table types
+        * @param $domains If true, will include domains
         * @return A recordet
         */
-       function &getTypes($all = false, $tabletypes = false) {
+       function &getTypes($all = false, $tabletypes = false, $domains = false) {
                if ($all)
                        $where = 'pg_catalog.pg_type_is_visible(t.oid)';
                else
@@ -855,10 +856,14 @@ class Postgres73 extends Postgres72 {
                // Never show system table types
                $where2 = "AND c.relnamespace NOT IN (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname LIKE 'pg\\\\_%')";
 
+               // Create type filter
+               $tqry = "'c'";
                if ($tabletypes)
-                       $tqry = "'c', 'r', 'v'";
-               else
-                       $tqry = "'c'";
+                       $tqry .= ", 'r', 'v'";
+
+               // Create domain filter
+               if (!$domains)
+                       $where .= " AND t.typtype != 'd'";
                        
                $sql = "SELECT
                                t.typname AS basename,
@@ -870,8 +875,7 @@ class Postgres73 extends Postgres72 {
                                LEFT JOIN pg_catalog.pg_user pu ON t.typowner = pu.usesysid
                        WHERE (t.typrelid = 0 OR (SELECT c.relkind IN ({$tqry}) FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid {$where2}))  
                        AND t.typname !~ '^_'
-                       AND {$where}
-                       AND t.typtype != 'd'
+                       AND {$where}                    
                        ORDER BY typname
                ";
 
index 6407f7f90a001a610da222399c9c7c1013c659e8..28d05e469984e434780e832f42e6eb1a03714761 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage functions in a database
         *
-        * $Id: functions.php,v 1.32 2004/06/03 06:42:20 chriskl Exp $
+        * $Id: functions.php,v 1.33 2004/06/28 02:26:56 chriskl Exp $
         */
 
        // Include application functions
                if (!isset($_POST['formProperties'])) $_POST['formProperties'] = $data->defaultprops;
                if (!isset($_POST['formSetOf'])) $_POST['formSetOf'] = '';
                if (!isset($_POST['formArray'])) $_POST['formArray'] = '';
-               
-               $types = &$data->getTypes(true, true);
+
+               $types = &$data->getTypes(true, true, true);
                $langs = &$data->getLanguages(true);
 
                echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strfunctions']}: {$lang['strcreatefunction']}</h2>\n";
index e1de12860a70644052beb5261d3fb2b4103134be..c930fc43bda9aa1099ef82fc7f632e010c14fdfb 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.56 2004/06/26 22:24:09 xzilla Exp $
+        * $Id: tables.php,v 1.57 2004/06/28 02:26:56 chriskl Exp $
         */
 
        // Include application functions
@@ -71,7 +71,7 @@
                                        return;
                                }
 
-                               $types = &$data->getTypes(true);
+                               $types = &$data->getTypes(true, false, true);
        
                                $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $lang['strcreatetable']), 'create_table');
                                $misc->printMsg($msg);
index d28228ee10609c7d3c069dc625bc7fddc94947c1..75e438653964388013959bee7392329f0be953cd 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tblproperties.php,v 1.50 2004/06/26 22:24:09 xzilla Exp $
+        * $Id: tblproperties.php,v 1.51 2004/06/28 02:26:57 chriskl Exp $
         */
 
        // Include application functions
                                if (!isset($_POST['comment'])) $_POST['comment'] = '';
 
                                // Fetch all available types
-                               $types = &$data->getTypes(true);
+                               $types = &$data->getTypes(true, false, true);
 
                                echo "<h2>", $misc->printVal($_REQUEST['database']), ": ",
                                        $misc->printVal($_REQUEST['table']), ": {$lang['straddcolumn']}</h2>\n";
                                // Column type.  On 7.5+ this can be altered
                                if ($data->hasAlterColumnType()) {
                                        // Fetch all available types
-                                       $types = &$data->getTypes(true);
+                                       $types = &$data->getTypes(true, false, true);
                                        
                                        echo "<td><select name=\"type\">\n";                            
                                        // Output any "magic" types.  This came in with Alter Column Type so we don't need to check that