Re: Boolean output format

From: Jeff Davis <list-pgsql-general(at)empires(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Boolean output format
Date: 2002-10-05 03:06:52
Message-ID: 200210042006.52860.list-pgsql-general@empires.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nikhil G. Daddikar 2002-10-05 03:27:00 Re: Deadlock
Previous Message Tom Lane 2002-10-05 03:03:22 Re: Pg 7.2.3 configure error