From 734bc07a80b47b4e6620c5360462258657dfb3e3 Mon Sep 17 00:00:00 2001 From: chriskl Date: Tue, 5 Aug 2003 01:54:09 +0000 Subject: [PATCH] fix for boolean field problems reported by Thomas Raschbacher --- HISTORY | 8 ++++++-- classes/database/Postgres.php | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index dc6b3879..4bb337b4 100644 --- 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 ----------- diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index b10f1aea..30301fff 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -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 "\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 "\n"; + } + else { + echo "\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 "
", var_dump($temp), "
"; $temp = array(); // Cachable + $f['proiscachable'] = $this->phpBool($f['proiscachable']); if ($f['proiscachable']) $temp[] = 'ISCACHABLE'; else -- 2.39.5