Home | Previous Page | Next Page   DataBlade API Overview > Accessing SQL Data Types > Boolean Data Types >

Boolean Binary Representation

The SQL BOOLEAN data type holds the internal (binary) format of a Boolean value. This value is a single-byte representation of Boolean data, as the following table shows.

Boolean Value
Binary Representation
True
\1
False
\0

The BOOLEAN data type is a predefined opaque type (an opaque data type that Informix defines). Its external format is the Boolean text representation that Table 12 shows. Its internal format consists of the values that the preceding table shows. For a complete description of the SQL BOOLEAN data type, see the IBM Informix: Guide to SQL Reference.

Tip:
The internal format of the BOOLEAN data type is often referred to as its binary representation.

The DataBlade API supports the SQL BOOLEAN data type with the mi_boolean data type. Therefore, the mi_boolean data type also holds the binary representation of a Boolean value.

Server Only

An mi_boolean value is one byte on all computer architectures; therefore, it can fit into an MI_DATUM structure. You can pass mi_boolean data by value in C UDRs.

End of Server Only
Client Only

In client LIBMI applications, you must pass all data by reference, including mi_boolean values.

End of Client Only
Windows Only

Because an mi_boolean value is smaller than the size of an MI_DATUM structure, the DataBlade API cast promotes the value to the size of MI_DATUM when you copy the value into an MI_DATUM structure. When you obtain the mi_boolean value from an MI_DATUM structure, you need to reverse the cast promotion to ensure that your value is correct.

MI_DATUM datum;
mi_boolean bool_val;
...
bool_val = (char) datum;

Alternatively, you can declare an mi_integer value to hold the Boolean value.

End of Windows Only
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]