Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-11 Thread Torsten Zühlsdorff

Thom Brown schrieb:


A long-standing problem we've had with PostgreSQL queries in PHP is
that the returned data for boolean columns is the string 'f' instead
of the native boolean value of false.


This problem is solved since nearly 5 years with PDO. You can use an 
abstraction like DDDBL (see my signature) if you want to save time while 
using PDO.


Greetings from Germany,
Torsten

--
http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8 
verschiedenen Datenbanksystemen abstrahiert,
Queries von Applikationen trennt und automatisch die Query-Ergebnisse 
auswerten kann.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread Thom Brown
Hi,

A long-standing problem we've had with PostgreSQL queries in PHP is
that the returned data for boolean columns is the string 'f' instead
of the native boolean value of false.

An obvious example of this would be for a table with users and their
boolean registered status:

Select user, registered From users;

Then getting a row from the result would reveal: array('user' =
'thomb', registered = 'f');

Another problem is with arrays, where they are difficult to parse as
they also come through as plain strings with no binary alternative.

 Is this a limitation of libpq or a flawed implementation in the php
library?  And if this is just the case for backwards-compatibility, is
there a way to switch it to a more sensible PHP data type?

Thanks

Thom

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread A. Kretschmer
In response to Thom Brown :
 Hi,
 
 A long-standing problem we've had with PostgreSQL queries in PHP is
 that the returned data for boolean columns is the string 'f' instead
 of the native boolean value of false.

http://andreas.scherbaum.la/blog/archives/302-BOOLEAN-datatype-with-PHP-compatible-output.html

Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread Tommy Gildseth

Thom Brown wrote:

 Is this a limitation of libpq or a flawed implementation in the php
library?  And if this is just the case for backwards-compatibility, is
there a way to switch it to a more sensible PHP data type?


Using PDO(http://no.php.net/pdo) will at least give you native values 
for true/false. Arrays, I don't know, since I don't use them.


--
Tommy Gildseth

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread Thom Brown
On 10 February 2010 12:11, A. Kretschmer
andreas.kretsch...@schollglas.com wrote:
 In response to Thom Brown :
 Hi,

 A long-standing problem we've had with PostgreSQL queries in PHP is
 that the returned data for boolean columns is the string 'f' instead
 of the native boolean value of false.

 http://andreas.scherbaum.la/blog/archives/302-BOOLEAN-datatype-with-PHP-compatible-output.html


Thanks guys.  I can see that this is specifically a PHP issue then.
It seems like an extreme workaround though.  I'd rather see the PHP
library updated in a way that would somehow not break existing code
which checked for an 'f'.  Not quite sure what the solution would be.

Thanks

Thom

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread Torsten Zühlsdorff

Thom Brown schrieb:


A long-standing problem we've had with PostgreSQL queries in PHP is
that the returned data for boolean columns is the string 'f' instead
of the native boolean value of false.


This problem is solved since nearly 5 years with PDO. You can use an
abstraction like DDDBL (see my signature) if you want to save time while
using PDO.

Greetings from Germany,
Torsten

--
http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8 
verschiedenen Datenbanksystemen abstrahiert,
Queries von Applikationen trennt und automatisch die Query-Ergebnisse 
auswerten kann.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general