Re: boolean 't' 'f' vs. '1' '0' - perl question

From: "Peter Haworth" <pmh(at)edison(dot)ioppublishing(dot)com>
To: "Henrik Steffen" <steffen(at)city-map(dot)de>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 15:11:27
Message-ID: PGM.20021231151127.541.2834@edison.ioppublishing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 31 Dec 2002 15:18:08 +0100, Henrik Steffen wrote:
> I am just trying to (finally) upgrade from Pg.pm to
> DBI (DBD::Pg) ...
>
> Until today, Pg.pm delivered a 't' or a 'f' for
> true or false boolean values.
>
> Since the upgrade, DBI delivers a '1' or a '0'.
>
> Question: Does anyone know if there's possibly a
> parameter to set to tell DBI to deliver 't' and 'f'
> instead of '1' and '0' ?

Not in the current version. It looks like it should be easy enough to hack,
though. Just remove lines 1360-1362 of dbdimp.c:

if (16 == type) {
*val = (*val == 'f') ? '0' : '1'; /* bool: translate postgres into perl */
}

This will probably mean that tests will fail, but looks harmless enough
otherwise.

--
Peter Haworth pmh(at)edison(dot)ioppublishing(dot)com
"I don't have to impress you. And as you're an emacs weenie who
doesn't even speak Martian Swahili, I would never expect to."
-- Tom Christiansen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Henrik Steffen 2002-12-31 15:28:55 Re: boolean 't' 'f' vs. '1' '0' - perl question
Previous Message Henrik Steffen 2002-12-31 14:18:08 boolean 't' 'f' vs. '1' '0' - perl question