Re: ODBC Boolean handling - Mailing list pgsql-patches

From Hiroshi Inoue
Subject Re: ODBC Boolean handling
Date
Msg-id 3B6A641E.A1A63341@tpf.co.jp
Whole thread Raw
In response to Re: ODBC Boolean handling  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: ODBC Boolean handling  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@oz.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 '=='.  >>>>>>>>

pgsql-patches by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Full Text Indexing Patch
Next
From: Bruce Momjian
Date:
Subject: Re: ODBC Boolean handling