fix for boolean field problems reported by Thomas Raschbacher
authorchriskl <chriskl>
Tue, 5 Aug 2003 01:54:09 +0000 (01:54 +0000)
committerchriskl <chriskl>
Tue, 5 Aug 2003 01:54:09 +0000 (01:54 +0000)
HISTORY
classes/database/Postgres.php

diff --git a/HISTORY b/HISTORY
index dc6b3879bd1d9e6bc4f16dfc4499baba595da3c8..4bb337b40bf8738ab4686fb1b63d8ed8510741e8 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -4,8 +4,8 @@ phpPgAdmin History
 Version 3.1
 -----------
 
+Features:
 * Turkish update from Devrim Gunduz
-* Support zero column tables
 * Add first & last links to nav.  Double number of pages shown.
 * German update from Markus Bertheau
 * Allow granting privileges WITH GRANT OPTION for 7.4
@@ -17,10 +17,14 @@ Version 3.1
 * Pop-up SQL window from Mark Gibson
 * Superusers can always see all databases
 * Default database encoding for languages
-* Lots of NULL value in table dump fixes (XML format changed slightly)
 * Convert our images to PNG format
 * Allow creating tables WITHOUT OIDS
 
+Bug Fixes:
+* Lots of NULL value in table dump fixes (XML format changed slightly)
+* Boolean default values and general boolean field handling fixes
+* Support zero column tables
+
 Version 3.0
 -----------
 
index b10f1aea5241a687eb688a1e6d32c1cc7a2051fc..30301fff5a5f69ff6f8047b383d49dbb7cbcfda5 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.131 2003/08/04 08:27:27 chriskl Exp $
+ * $Id: Postgres.php,v 1.132 2003/08/05 01:54:10 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -348,11 +348,20 @@ class Postgres extends BaseDB {
                        case 'bool':
                        case 'boolean':
                                if ($value !== null && $value == '') $value = null;
-                               echo "<select name=\"", htmlspecialchars($name), "\">\n";
-                               echo "<option value=\"\"", ($value === null) ? ' selected' : '', "></option>\n";
-                               echo "<option value=\"t\"", ($value == 't') ? ' selected' : '', ">{$lang['strtrue']}</option>\n";
-                               echo "<option value=\"f\"", ($value == 'f') ? ' selected' : '', ">{$lang['strfalse']}</option>\n";
-                               echo "</select>\n";
+                               elseif ($value == 'true') $value = 't';
+                               elseif ($value == 'false') $value = 'f';
+                               
+                               // If value is null, 't' or 'f'...
+                               if ($value === null || $value == 't' || $value == 'f') {
+                                       echo "<select name=\"", htmlspecialchars($name), "\">\n";
+                                       echo "<option value=\"\"", ($value === null) ? ' selected' : '', "></option>\n";
+                                       echo "<option value=\"t\"", ($value == 't') ? ' selected' : '', ">{$lang['strtrue']}</option>\n";
+                                       echo "<option value=\"f\"", ($value == 'f') ? ' selected' : '', ">{$lang['strfalse']}</option>\n";
+                                       echo "</select>\n";
+                               }
+                               else {
+                                       echo "<input name=\"", htmlspecialchars($name), "\" value=\"", htmlspecialchars($value), "\" size=\"35\" />\n";
+                               }                               
                                break;
                        case 'text':
                        case 'bytea':
@@ -381,8 +390,10 @@ class Postgres extends BaseDB {
                                        return 'TRUE';
                                elseif ($value == 'f')
                                        return 'FALSE';
+                               elseif ($value == '')
+                                       return 'NULL';
                                else
-                                       return "''";
+                                       return $value;
                                break;          
                        default:
                                // Checking variable fields is difficult as there might be a size
@@ -2089,7 +2100,7 @@ class Postgres extends BaseDB {
                                                CAST('public' AS TEXT) AS schemaname,
                                                CAST(NULL AS TEXT) AS relname,
                                                relname AS name,
-                                               NULL AS relacl
+                                               relacl
                                        FROM
                                                pg_class
                                        WHERE
@@ -2431,6 +2442,7 @@ echo "<pre>", var_dump($temp), "</pre>";
                $temp = array();
 
                // Cachable
+               $f['proiscachable'] = $this->phpBool($f['proiscachable']);
                if ($f['proiscachable'])
                        $temp[] = 'ISCACHABLE';
                else