Subject Re: [IBO] boolean domain and IBO
Author Geoff Worboys
Hi Ales,

What type of field you use for boolean in IB/FB is very much a matter
of taste. And since Marco gave you the arguments for using CHAR(1) I
will offer the reasons why I use smallint. :-)

I used char(1) for a long time, then I started to write UDFs and found
that passing and returning smallint helped make my C UDF code just a
little simpler (not much). So I started using 0/1 smallint boolean
fields so they were consistent with my UDFs. I also began to
implement many of my multiple choice options as smallint with
translation to phrase at the client - using combobox features
available in IBO or Enh. This meant that using smallint for boolean
was consistent with my other data.

I have seen argument that CHAR(1) takes only one byte, whereas
SMALLINT takes two. However this depends on your character set. It
seemed to me that there must be some small overhead at the server in
having to deal with character sets on a CHAR(1) field so I thought
that SMALLINT may be more efficient (but have no empirical evidence
to support this).

As Marco pointed out, you are not restricted to the two options. And
indeed you can have a mixture throughout your database (T/F, 1/0, Y/N,
M/F etc). Probably it is better not to mix unless less there is good
reason (eg. perhaps Male/Female although I use combobox for this and
not boolean/checkbox). The main thing is to tell IBO about your
boolean domain/field using ColumnAttributes.


--
Geoff Worboys
Telesis Computing