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

Lists: pgsql-general
From: "Henrik Steffen" <steffen(at)city-map(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Subject: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 14:18:08
Message-ID: 018001c2b0d7$712013a0$7100a8c0@henrik
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

(excuse me, if it's a little off topic)

hello all,

I am just trying to (finally) upgrade from Pg.pm to
DBI (DBD::Pg) ...

I encounter the following problem:

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'.

This is a problem for me, because of hundred thousands
lines of code containing many many comparisons in perl
like: if ($member eq "t") { foo; } -- which I really
don't fance to change one by one...

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' ?

thanks,

happy new year ;-))

--

Mit freundlichem Gruß

Henrik Steffen
Geschäftsführer

top concepts Internetmarketing GmbH
Am Steinkamp 7 - D-21684 Stade - Germany
--------------------------------------------------------
http://www.topconcepts.com Tel. +49 4141 991230
mail: steffen(at)topconcepts(dot)com Fax. +49 4141 991233
--------------------------------------------------------
24h-Support Hotline: +49 1908 34697 (EUR 1.86/Min,topc)
--------------------------------------------------------
Ihr SMS-Gateway: JETZT NEU unter: http://sms.city-map.de
System-Partner gesucht: http://www.franchise.city-map.de
--------------------------------------------------------
Handelsregister: AG Stade HRB 5811 - UstId: DE 213645563
--------------------------------------------------------


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
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


From: "Henrik Steffen" <steffen(at)city-map(dot)de>
To: "Peter Haworth" <pmh(at)edison(dot)ioppublishing(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 15:28:55
Message-ID: 018e01c2b0e1$54973100$7100a8c0@henrik
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

thanks, this works fine for me ;-)

happy new year,

--

Mit freundlichem Gruß

Henrik Steffen
Geschäftsführer

top concepts Internetmarketing GmbH
Am Steinkamp 7 - D-21684 Stade - Germany
--------------------------------------------------------
http://www.topconcepts.com Tel. +49 4141 991230
mail: steffen(at)topconcepts(dot)com Fax. +49 4141 991233
--------------------------------------------------------
24h-Support Hotline: +49 1908 34697 (EUR 1.86/Min,topc)
--------------------------------------------------------
Ihr SMS-Gateway: JETZT NEU unter: http://sms.city-map.de
System-Partner gesucht: http://www.franchise.city-map.de
--------------------------------------------------------
Handelsregister: AG Stade HRB 5811 - UstId: DE 213645563
--------------------------------------------------------

----- Original Message -----
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>
Sent: Tuesday, December 31, 2002 4:11 PM
Subject: Re: [GENERAL] boolean 't' 'f' vs. '1' '0' - perl question

> 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


From: Michael Teter <mt_pgsql(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 16:34:54
Message-ID: 20021231163454.4313.qmail@web14801.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

With each successive release of DBD::Pg, you'll have
to go modify the module again...

Wouldn't it make more sense to modify your code to use
1/0 instead?

MT

--- Henrik Steffen <steffen(at)city-map(dot)de> wrote:
> thanks, this works fine for me ;-)
>
> happy new year,
>
>
> --
>
> Mit freundlichem Gru
>
> Henrik Steffen
> Geschftsfhrer
>
> top concepts Internetmarketing GmbH
> Am Steinkamp 7 - D-21684 Stade - Germany
>
--------------------------------------------------------
> http://www.topconcepts.com Tel. +49 4141
> 991230
> mail: steffen(at)topconcepts(dot)com Fax. +49 4141
> 991233
>
--------------------------------------------------------
> 24h-Support Hotline: +49 1908 34697 (EUR
> 1.86/Min,topc)
>
--------------------------------------------------------
> Ihr SMS-Gateway: JETZT NEU unter:
> http://sms.city-map.de
> System-Partner gesucht:
> http://www.franchise.city-map.de
>
--------------------------------------------------------
> Handelsregister: AG Stade HRB 5811 - UstId: DE
> 213645563
>
--------------------------------------------------------
>
> ----- Original Message -----
> 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>
> Sent: Tuesday, December 31, 2002 4:11 PM
> Subject: Re: [GENERAL] boolean 't' 'f' vs. '1' '0' -
> perl question
>
>
> > 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
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
> (send "unregister YourEmailAddressHere" to
majordomo(at)postgresql(dot)org)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From: "Peter Haworth" <pmh(at)edison(dot)ioppublishing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 18:49:51
Message-ID: PGM.20021231184951.541.2836@edison.ioppublishing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, 31 Dec 2002 08:34:54 -0800 (PST), Michael Teter wrote:
> With each successive release of DBD::Pg, you'll have to go modify the
> module again...

Well, I just sent in a patch which makes this behaviour switchable with
a database handle attribute, so maybe it'll be in the next version of
the driver.

--
Peter Haworth pmh(at)edison(dot)ioppublishing(dot)com
'As Annie Oakley almost said, "Anything you can do, I can do meta."'
-- Larry Wall


From: Michael Teter <mt_pgsql(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: boolean 't' 'f' vs. '1' '0' - perl question
Date: 2002-12-31 19:57:34
Message-ID: 20021231195734.28635.qmail@web14804.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Very nice of you :)

I thought it, but didn't suggest it since I'm not
qualified to make such a change.

MT

--- Peter Haworth <pmh(at)edison(dot)ioppublishing(dot)com>
wrote:
> On Tue, 31 Dec 2002 08:34:54 -0800 (PST), Michael
> Teter wrote:
> > With each successive release of DBD::Pg, you'll
> have to go modify the
> > module again...
>
> Well, I just sent in a patch which makes this
> behaviour switchable with
> a database handle attribute, so maybe it'll be in
> the next version of
> the driver.
>
> --
> Peter Haworth pmh(at)edison(dot)ioppublishing(dot)com
> 'As Annie Oakley almost said, "Anything you can do,
> I can do meta."'
> -- Larry Wall
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
> (send "unregister YourEmailAddressHere" to
majordomo(at)postgresql(dot)org)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From: Mohd Ghalib Akhtar <md_ghalib(at)yahoo(dot)com>
To: Peter Haworth <pmh(at)edison(dot)ioppublishing(dot)com>, Henrik Steffen <steffen(at)city-map(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: help
Date: 2003-01-01 12:08:31
Message-ID: 20030101120831.60608.qmail@web41210.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

how to connect html page to psql ?

=====
Take careMohd.Ghalib Akhtar(office)91-11-6152172,Ext-217
Fax : 91-11-6146217, 6149446
---------------------------------

---------------------------------

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Mohd Ghalib Akhtar <md_ghalib(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: help
Date: 2003-01-01 12:34:33
Message-ID: 5.1.0.14.1.20030101203258.028399c0@mbox.jaring.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Why do you want to do that?

Can you explain more on what you are trying to do?

At 04:08 AM 1/1/03 -0800, Mohd Ghalib Akhtar wrote:

>how to connect html page to psql ?
>
>=====
>Take careMohd.Ghalib Akhtar(office)91-11-6152172,Ext-217
>Fax : 91-11-6146217, 6149446


From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: Mohd Ghalib Akhtar <md_ghalib(at)yahoo(dot)com>
Cc: Peter Haworth <pmh(at)edison(dot)ioppublishing(dot)com>, Henrik Steffen <steffen(at)city-map(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: help
Date: 2003-01-02 18:48:14
Message-ID: 3E14896E.4030907@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Try SSI (Server Side Include)...

I have feeling you mean something else....something like how do you
write a web (or HTML)
based application with PG backend.

Mohd Ghalib Akhtar wrote:

>how to connect html page to psql ?
>
>=====
>Take careMohd.Ghalib Akhtar(office)91-11-6152172,Ext-217
>Fax : 91-11-6146217, 6149446
>---------------------------------
>
>---------------------------------
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>