Re: Boolean output format - Mailing list pgsql-general

From Jeff Davis
Subject Re: Boolean output format
Date
Msg-id 200210042006.52860.list-pgsql-general@empires.org
Whole thread Raw
In response to Re: Boolean output format  (Doug McNaught <doug@wireboard.com>)
List pgsql-general
>
> The database adapters I've used (Perl DBI and Java JDBC) arrange for
> Boolean columns in query output to resolve as "true" or "false"
> according to that language's conventions.  If the PHP adapter doesn't
> do this, someone needs to fix it IMHO.  Different DBs have different
> conventions about a lot of things and the adapters need to cope.
>

I agree. However, I think "adapter" is too strong a word for PHP's PostgreSQL
interface. It's mostly a wrapper around the C API, and just throws the result
as a string in a variable (just the way it get's it from the C function, as a
string).

Anything beyond that is PHP's dynamic typing at work. In this situation, it's
merely casting MySQL's "0" to false (that's the character zero), and casting
PostgreSQL's "f" to true (bacause it's a non-empty string).

Not something that I'd bet my application on, but it works for PHP/MySQL in
most cases appearently.

Regards,
    Jeff Davis



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Pg 7.2.3 configure error
Next
From: Stephan Szabo
Date:
Subject: Re: Deadlock