Switch to: V9V8V7V6V5

Boolean Field

Range of Type

This type of field can contains Values 0/1, which you can interpretate as True/False, Yes/No, On/Off.

Storage

This range of values can be stored in ONE BIT.

Most of other DBMS use for this type either one byte on disk per boolean field or they pack few bits into ONE byte until table have from 1 to 8 boolean fields, then start use the second byte, and so on.

Valentina in contrast, always uses really one bit on disk per field for its values. This is thanks to the format of field storage - each field is stored as separate logical file.

Flags

  • fNullable

This field can be declared as Nullable. In this case a special bitmap is associated with this field.

Nullable Boolean field is able to keep 3-state values: { NULL, True, False }.

  • fIndexed

Boolean field always have this flag ON. You cannot set it OFF. This is because storage of this field is such effective that there is no need for index at all.

Read Mode About Field Flags

Indexes

See description of the fIndexed flag above.

API

This field type is represented at the API level by VBoolean Class.

SQL

At SQL Level you can create such field using

CREATE TABLE T1( fldBoolean BOOLEAN );

You can search this field using comparison to TRUE/FALSE:

SELECT * FROM T1 WHERE fldBoolean = TRUE;