Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15471 invoked by uid 1010); 7 Nov 2004 18:30:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15426 invoked from network); 7 Nov 2004 18:30:01 -0000 Received: from unknown (HELO ms-smtp-01-eri0.ohiordc.rr.com) (65.24.5.135) by pb1.pair.com with SMTP; 7 Nov 2004 18:30:01 -0000 Received: from ender (cpe-066-061-066-254.midsouth.rr.com [66.61.66.254]) by ms-smtp-01-eri0.ohiordc.rr.com (8.12.10/8.12.7) with SMTP id iA7ITYlv025946; Sun, 7 Nov 2004 13:29:52 -0500 (EST) To: "Sean Chittenden" , Date: Sun, 7 Nov 2004 12:38:06 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <30EB6453-305B-11D9-80C2-000A95C705DC@chittenden.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: Symantec AntiVirus Scan Engine Subject: RE: [PHP-DEV] PostgreSQL driver handles boolean values incorrectly... From: michaels@crye-leike.com ("Michael Sims") References: <30EB6453-305B-11D9-80C2-000A95C705DC@chittenden.org> Sean Chittenden wrote: > A boolean value is returned as the strings 't' and 'f', not the > constants true and false. This presents all kinds of interesting > oddities for code that does something like: [...] You're probably already aware of this, but you can use a bit(1) field as a boolean and this will map to PHP values that will allow you to check for truth in conditionals. Personally I do that instead of using Postgres's boolean since other database systems I've worked with don't have a boolean type, but they all have a bit type. Although I agree that it would be nice for PHP to map pg's boolean to PHP's boolean... > The same problem lies with the NULL value, which IMHO, should be > mapped to the constant NULL, not the string 'NULL'. I was unable to reproduce this. The following code: $r = pg_query($dbh, "create table test (field1 varchar(10))"); $r = pg_query($dbh, "insert into test values (NULL)"); $r = pg_query($dbh, "select field1 from test"); $row = pg_fetch_row($r); var_dump($row); $r = pg_query($dbh, "drop table test"); outputs: array(1) { [0]=> NULL } On PHP 4.3.9, Postgresql 7.4.5, running on Linux (Debian Sarge). If you get different results perhaps you've uncovered a bug that should be reported...