Re: ODBC Boolean handling

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Aidan Mountford <Aidan(at)oz(dot)to>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ODBC Boolean handling
Date: 2001-08-03 08:43:10
Message-ID: 3B6A641E.A1A63341@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I wrote:
>
> Bruce Momjian wrote:
> >
> > Here is the submitted patch so everyone can see it.
> >
>
> I agree to the first change but am suspicious about the
> second change.
>
> > > > 2) I had issues with some utilities that, when casting from string to
> > > > boolean, and having
> > > > the global 'bools as char' set, require that -1 = True, and 0 = false.
> > > >
>
> Though Aidan is right, is -1 guaranteed to be true in
> any application conversely ? It seems also different
> from the ODBC spec. I don't have the solution now.
>

Please never apply the second part.
I would propose another idea instead soon(hopefully).

regards,
Hiroshi Inoue

-- 425,452 ----
break;

case PG_TYPE_BOOL:
!
if (cbValueMax > len)

<<<<<<< len isn't set at this point. >>>>>>>

{
! /* Aidan Mountford
(aidan(at)oz(dot)to) 1/08/2001:
!
! When returning a CHAR
datatype, return -1
! instead of +1.
!
! That way if someone
casts it back to a boolean
! again - it will work.
! */
! if ( *(char *) value = '1')

<<<<<<<< '=' must be '=='. >>>>>>>>

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-08-03 13:24:42 Re: Patch for Improved Syntax Error Reporting
Previous Message Christopher Kings-Lynne 2001-08-03 08:04:47 Full Text Indexing Patch