pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
boolean 't' 'f' vs. '1' '0' - perl question
6+ messages / 3 participants
[nested] [flat]

* boolean 't' 'f' vs. '1' '0' - perl question
@ 2002-12-31 14:18 Henrik Steffen <steffen@city-map.de>
  2002-12-31 15:11 ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Henrik Steffen @ 2002-12-31 14:18 UTC (permalink / raw)
  To: 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@topconcepts.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
--------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: boolean 't' 'f' vs. '1' '0' - perl question
  2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
@ 2002-12-31 15:11 ` Peter Haworth <pmh@edison.ioppublishing.com>
  2002-12-31 15:28   ` Re: boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Haworth @ 2002-12-31 15:11 UTC (permalink / raw)
  To: Henrik Steffen <steffen@city-map.de>; 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@edison.ioppublishing.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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: boolean 't' 'f' vs. '1' '0' - perl question
  2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 15:11 ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
@ 2002-12-31 15:28   ` Henrik Steffen <steffen@city-map.de>
  2002-12-31 16:34     ` Re: boolean 't' 'f' vs. '1' '0' - perl question Michael Teter <mt_pgsql@yahoo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Henrik Steffen @ 2002-12-31 15:28 UTC (permalink / raw)
  To: Peter Haworth <pmh@edison.ioppublishing.com>; +Cc: 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@topconcepts.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@edison.ioppublishing.com>
To: "Henrik Steffen" <steffen@city-map.de>; <pgsql-general@postgresql.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@edison.ioppublishing.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




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: boolean 't' 'f' vs. '1' '0' - perl question
  2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 15:11 ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
  2002-12-31 15:28   ` Re: boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
@ 2002-12-31 16:34     ` Michael Teter <mt_pgsql@yahoo.com>
  2002-12-31 18:49       ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael Teter @ 2002-12-31 16:34 UTC (permalink / raw)
  To: 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@city-map.de> wrote:
> 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@topconcepts.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@edison.ioppublishing.com>
> To: "Henrik Steffen" <steffen@city-map.de>;
> <pgsql-general@postgresql.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@edison.ioppublishing.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@postgresql.org)


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: boolean 't' 'f' vs. '1' '0' - perl question
  2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 15:11 ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
  2002-12-31 15:28   ` Re: boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 16:34     ` Re: boolean 't' 'f' vs. '1' '0' - perl question Michael Teter <mt_pgsql@yahoo.com>
@ 2002-12-31 18:49       ` Peter Haworth <pmh@edison.ioppublishing.com>
  2002-12-31 19:57         ` Re: boolean 't' 'f' vs. '1' '0' - perl question Michael Teter <mt_pgsql@yahoo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Haworth @ 2002-12-31 18:49 UTC (permalink / raw)
  To: 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@edison.ioppublishing.com
'As Annie Oakley almost said, "Anything you can do, I can do meta."'
		-- Larry Wall



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: boolean 't' 'f' vs. '1' '0' - perl question
  2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 15:11 ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
  2002-12-31 15:28   ` Re: boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
  2002-12-31 16:34     ` Re: boolean 't' 'f' vs. '1' '0' - perl question Michael Teter <mt_pgsql@yahoo.com>
  2002-12-31 18:49       ` Re: boolean 't' 'f' vs. '1' '0' - perl question Peter Haworth <pmh@edison.ioppublishing.com>
@ 2002-12-31 19:57         ` Michael Teter <mt_pgsql@yahoo.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Teter @ 2002-12-31 19:57 UTC (permalink / raw)
  To: 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@edison.ioppublishing.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@edison.ioppublishing.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@postgresql.org)


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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2002-12-31 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31 14:18 boolean 't' 'f' vs. '1' '0' - perl question Henrik Steffen <steffen@city-map.de>
2002-12-31 15:11 ` Peter Haworth <pmh@edison.ioppublishing.com>
2002-12-31 15:28   ` Henrik Steffen <steffen@city-map.de>
2002-12-31 16:34     ` Michael Teter <mt_pgsql@yahoo.com>
2002-12-31 18:49       ` Peter Haworth <pmh@edison.ioppublishing.com>
2002-12-31 19:57         ` Michael Teter <mt_pgsql@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox