Re: Boolean output format

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Boolean output format
Дата
Msg-id 200210042006.52860.list-pgsql-general@empires.org
обсуждение исходный текст
Ответ на Re: Boolean output format  (Doug McNaught <doug@wireboard.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Pg 7.2.3 configure error
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Deadlock