Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Null field support

The c-treeDB record manager API implements the underlying support for null fields, but does not enforce it. If a table was created with null field support, the record manager will set or clear the null bit flag for fields, but there is no check to see if null fields are allowed or not.

When CTRecord::Clear() clears a record buffer, all fields are marked as null fields. As you update the field contents by calling SetFieldAs...() methods, the null field for the respective field is cleared indicating that the field contains data.

A specific field can be cleared, and its null field flag set, by calling CTRecord::ClearField() method. Call CTRecord::IsNullField() to check if a field null flag is set.

// if a field 0 is not null, clear the field

if (!ARecord.IsNullField(0))

{

ARecord.ClearField(0);

}

The c-treeDB null flag controls the NOT NULL property of a column. Setting this to column has no effect on individual record null values: it is NOT enforced at the c-treeDB layer. This attribute only applies to the FairCom DB SQL layer for constraint on values. It is useful to set this flag in c-tree data files before SQL import such that the property is maintained.

TOCIndex