Subject Boolean Fields
Author Ken Galbraith
Hi Guys

In my legacy CB86 application, I store up to 15 Boolean flags (Y/N) type
fields in a small integer (16 bit) fields).

I am converting this to C++Builder/Firebird & am seeking the best way to
represent these flags (0/1, Y/N, True/False etc ) under a Firebird regime.

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.

I have been told by the experts in FB (Helen B for example) that I should
convert these values to chr(1) ie Y/N or T/F etc & while I am as aware as
any of you that CPU processor speed, HDD capacity etc, rave, rave ra ,ra
have eliminated the old problems of 64 kb memory space & 5 Mb HDD space, I
find it very hard to not try to keep disk storage & bytes transferred across
the network to a minimum.

Firebird doesn't have a Boolean data type. This doesn't concern me as I want
to use what FB has.

The question I am really asking is:

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.

PS: In my application I have as many as 30 of these binary fields ( which is
why I am inclined [ unless otherwise convinced ] to use int or small int
fields & use Boolean functions to split them up).

PPS: As an assembler programmer from way back (1968) I am well aware that
Boolean logic is shorter & much faster than string (or even single
character ) logic.

There must be some of you out there that have converted legacy applications
to ones using a modern RDBMS such as FB who have gone thru' this process!


Ken A Galbraith