show_system support for casts, fix hard-coded strings for casts
authorchriskl <chriskl>
Tue, 28 Oct 2003 04:02:13 +0000 (04:02 +0000)
committerchriskl <chriskl>
Tue, 28 Oct 2003 04:02:13 +0000 (04:02 +0000)
BUGS
casts.php
classes/database/Postgres73.php
lang/english.php
lang/recoded/english.php

diff --git a/BUGS b/BUGS
index 51b7da8968999dfaa145596439a63b130cb36eb6..2983c933c0d1b94558f30e0d3be5df1cb9f66d1b 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1,4 +1,3 @@
-support for show_system in casts
 fix getIndexes() and getConstraints() for < 7.3 to know about index type
   (eg. constraints can only be btree indexes)
 re-enable help system
index 6cb8cbf60f25fc2d89a82d45e78ca8fd6f5309da..a502a65870294426ea6b582ac1cd5756da314e52 100644 (file)
--- a/casts.php
+++ b/casts.php
@@ -3,7 +3,7 @@
        /**
         * Manage casts in a database
         *
-        * $Id: casts.php,v 1.2 2003/10/27 05:43:18 chriskl Exp $
+        * $Id: casts.php,v 1.3 2003/10/28 04:02:14 chriskl Exp $
         */
 
        // Include application functions
                                $id = (($i % 2) == 0 ? '1' : '2');
                                echo "<tr><td class=\"data{$id}\">", $misc->printVal($casts->f['castsource']), "</td>\n";
                                echo "<td class=\"data{$id}\">", $misc->printVal($casts->f['casttarget']), "</td>\n";
-                               echo "<td class=\"data{$id}\">", $misc->printVal($casts->f['castfunc']), "</td>\n";
-                               echo "<td class=\"data{$id}\">", $misc->printVal($casts->f['castcontext']), "</td>\n";
+                               echo "<td class=\"data{$id}\">", ($casts->f['castfunc'] === null) ? $lang['strbinarycompat'] : $misc->printVal($casts->f['castfunc']), "</td>\n";
+                               echo "<td class=\"data{$id}\">";
+                               switch ($casts->f['castcontext']) {
+                                       case 'e':
+                                               echo $lang['strno'];
+                                               break;
+                                       case 'a':
+                                               echo $lang['strinassignment'];
+                                               break;
+                                       default:
+                                               echo $lang['stryes'];                                                   
+                               }
+                               echo "</td>\n";
                                echo "</tr>\n";
                                $casts->moveNext();
                                $i++;
index a95bf06326fbb5b6161870efd755076966582d69..3a52beda92bbb48662636b706fa0fb0f07562660 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.75 2003/10/27 05:43:18 chriskl Exp $
+ * $Id: Postgres73.php,v 1.76 2003/10/28 04:02:15 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -1248,21 +1248,36 @@ class Postgres73 extends Postgres72 {
         * @return All casts
         */      
        function &getCasts() {
-       
-               // @@ TRANSLATION PROBLEM HERE
+               global $conf;
+                               
+               if ($conf['show_system'])
+                       $where = '';
+               else
+                       $where = "
+                               AND n1.nspname NOT LIKE 'pg_%'
+                               AND n2.nspname NOT LIKE 'pg_%'
+                               AND n3.nspname NOT LIKE 'pg_%'
+                       ";
+
                $sql = "
                        SELECT
-                               castsource::pg_catalog.regtype AS castsource,
-                               casttarget::pg_catalog.regtype AS casttarget,
-                               CASE WHEN castfunc = 0 THEN '(binary compatible)'
-                               ELSE p.proname
-                               END AS castfunc,
-                               CASE WHEN c.castcontext = 'e' THEN 'no'
-                               WHEN c.castcontext = 'a' THEN 'in assignment'
-                               ELSE 'yes'
-                               END AS castcontext
-                       FROM pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p
-                               ON c.castfunc = p.oid
+                               c.castsource::pg_catalog.regtype AS castsource,
+                               c.casttarget::pg_catalog.regtype AS casttarget,
+                               CASE WHEN c.castfunc=0 THEN NULL
+                               ELSE c.castfunc::pg_catalog.regprocedure END AS castfunc,
+                               c.castcontext
+                       FROM
+                               (pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p ON c.castfunc=p.oid JOIN pg_catalog.pg_namespace n3 ON p.pronamespace=n3.oid),
+                               pg_catalog.pg_type t1,
+                               pg_catalog.pg_type t2,
+                               pg_catalog.pg_namespace n1,
+                               pg_catalog.pg_namespace n2                              
+                       WHERE
+                               c.castsource=t1.oid
+                               AND c.casttarget=t2.oid
+                               AND t1.typnamespace=n1.oid
+                               AND t2.typnamespace=n2.oid
+                               {$where}
                        ORDER BY 1, 2
                ";
 
index d8227872b55c49b63d97a7df65fe4f95e1a5860e..da3e2063c6de30f82a29b26e26d48118a0c5c6c7 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.119 2003/10/27 05:43:18 chriskl Exp $
+        * $Id: english.php,v 1.120 2003/10/28 04:02:15 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsourcetype'] = 'Source type';
        $lang['strtargettype'] = 'Target type';
        $lang['strimplicit'] = 'Implicit';
+       $lang['strinassignment'] = 'In assignment';
+       $lang['strbinarycompat'] = '(Binary compatible)';
        
        // Conversions
        $lang['strconversions'] = 'Conversions';
index f8641b20e5ae86f6e5cd35d3bbb7cf70102ca9b4..444425bde77ea88410de248309c8483b4a88a11a 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.71 2003/10/27 05:43:18 chriskl Exp $
+        * $Id: english.php,v 1.72 2003/10/28 04:02:16 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsourcetype'] = 'Source type';
        $lang['strtargettype'] = 'Target type';
        $lang['strimplicit'] = 'Implicit';
+       $lang['strinassignment'] = 'In assignment';
+       $lang['strbinarycompat'] = '(Binary compatible)';
        
        // Conversions
        $lang['strconversions'] = 'Conversions';