Subject RE: [firebird-support] Boolean Fields
Author Rick DeBay
I originally used the domain suggested in Helen's book, but changed the
values stored to 'Y' and 'N' to conform to Jaybird's handling of the
Java Boolean type.
If there is ever a chance of a Java application accessing your DB, you
may want to use Y/N.

-----Original Message-----
From: Ann W. Harrison [mailto:aharrison@...]
Sent: Thursday, October 28, 2004 2:27 PM
To: firebird-support@yahoogroups.com; firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Boolean Fields


At 10:58 AM 10/28/2004, Ken Galbraith wrote:

>Coming from the old school (I am 57 and started programming in 1967) I
have
>used signed integers (16 bit) to store up to 15 separate fields, using
>functions to set/get individual flags based on 2^n etc.

As I say to my husband (he and I are just about your age) "Get over it,
Jim,
the great bit depression ended twenty years ago."

There are UDF's that support bitwise operations, but the overhead of the
UDF plus the overhead in your program of getting the right bits in the
right place will swamp any gain you get by packing your flags into
single
integers.

>Should I use Integer/Big Int & concatenate my Boolean fields, or should
I
>convert them to char(1) values of "y"/"n" etc or smallint values of
0/1.

Use char(1). The engine will pick a fast comparison since it knows its
comparing one byte to another. If it makes you happy, make them charset
octets and store 0x1 and 0x0.
>

Regards,

Ann





Yahoo! Groups Links