Subject Re: [ib-support] Re: Boolean Fields
Author Paul Schmidt
On 27 Dec 2001, at 14:19, Ann W. Harrison wrote:

> At 12:33 PM 12/27/2001 -0500, Paul Schmidt wrote:
>
> >What we need is a bool type which assigns a single byte, using
> >the first bit of that byte, then when the next boolean is created it
> >uses the second bit, until you either run out of boolean fields, or
> >the byte is full. If the byte is full, it assigns another byte. A
> >number of other databases do this, so perhaps we can too.
>
> We >can< do almost anything. The question is what >should< we do
> with limited resources?
>
>
> Beyond that boolean datatypes worry me semantically - not the domains,
> which people seem to be able to live with, but real boolean types.
> Assuming that c1 is a boolean column, I would expect to be able to do
> this:
>
> where t1.c1 or t1.c2 = 12
> or
> set t1.c1 = NOT t1.c1
>
> That's going to require applying force and violence to Claudio's
> well beloved parser.
>

A true boolean would allow three values, TRUE, FALSE and NULL,
so a boolean would really be a two bit value, one bit representing
the NULL flag, and the second bit representing the true/false value.

Now a boolean should use the "magic" values of TRUE and
FALSE, and NULL. So setting the value to 0 or 1 or 12 or 255,
should return the same error as if you had a CHECK (VALUE IN
(FALSE,TRUE)) condition on the field, after all it's a coded value,
like date, time and timestamp are coded values.

Do we really need it, probably not, here is a semi-related question
though, how powerful is the UDF mechanism? Perhaps it could be
expanded, so that a UDF could be used to manage a data-type,
then folks could add their own data types. We could then work
towards an engine that simply calls UDFs to do all of it's work.

Paul

Paul Schmidt
Tricat Technologies
paul@...
www.tricattechnologies.com