pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bool values under Mac OS X
3+ messages / 2 participants
[nested] [flat]

* Bool values under Mac OS X
@ 2005-04-26 12:35  lothar.behrens@lollisoft.de
  0 siblings, 2 replies; 3+ messages in thread

From: lothar.behrens@lollisoft.de @ 2005-04-26 12:35 UTC (permalink / raw)
  To: pgsql-odbc

Hi,

I have detected problems with bool values under Mac OS X. 
Even configuring TrueIsMinus1=1 does not help.

My conversion is these:

bool b = *(bool*) buffer;

Where the buffer is an allocated space on heap to be bound as culumn.
If I use BoolsAsChar=1 I get values from 0 to 1.

The values are the same as under Windows.

Any help ?

Thanks

Lothar

-- 
Lothar Behrens		www.lollisoft.de
Rosmarinstr 3		My public project:
40235 Düsseldorf  	http://sourceforge.net/projects/lbdmf






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

* Re: Bool values under Mac OS X
@ 2005-04-26 14:24  Tom Lane <tgl@sss.pgh.pa.us>
  parent: lothar.behrens@lollisoft.de
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-04-26 14:24 UTC (permalink / raw)
  To: lothar.behrens@lollisoft.de; +Cc: pgsql-odbc

lothar.behrens@lollisoft.de writes:
> My conversion is these:
> bool b = *(bool*) buffer;

What's the data type of "buffer"?

On Intel hardware the above will fetch the low-order byte of "buffer",
but on PPC (and other big-endian) hardware, it will fetch the high-order
byte.  I suspect strongly that your problem has nothing to do with OS X
versus Windows and everything to do with being careless about endianness
issues.

			regards, tom lane



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

* Re: Bool values under Mac OS X
@ 2005-04-26 18:37  lothar.behrens@lollisoft.de
  parent: lothar.behrens@lollisoft.de
  1 sibling, 0 replies; 3+ messages in thread

From: lothar.behrens@lollisoft.de @ 2005-04-26 18:37 UTC (permalink / raw)
  To: pgsql-odbc

Am 26 Apr 2005 um 10:24 hat Tom Lane geschrieben:

> lothar.behrens@lollisoft.de writes:
> > My conversion is these:
> > bool b = *(bool*) buffer;
> 
> What's the data type of "buffer"?
> 

void*

> On Intel hardware the above will fetch the low-order byte of "buffer",
> but on PPC (and other big-endian) hardware, it will fetch the high-order
> byte.  I suspect strongly that your problem has nothing to do with OS X
> versus Windows and everything to do with being careless about endianness
> issues.

I have tried out ByteAsChar and got 0 or 1. Then I have done an int conversion
instead of bool. Then I got it working. 0 is false and all other values threaded true.

Lothar

> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 


-- 
Lothar Behrens		www.lollisoft.de
Rosmarinstr 3		My public project:
40235 Düsseldorf  	http://sourceforge.net/projects/lbdmf






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


end of thread, other threads:[~2005-04-26 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 12:35 Bool values under Mac OS X lothar.behrens@lollisoft.de
2005-04-26 14:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-04-26 18:37 ` lothar.behrens@lollisoft.de

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