Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Enable or disable the SQL “NOT NULL” property of this field's column, in order to control whether the SQL layer will allow NULL values to be written to fields in this column or not.


CTDBRET ctdbSetFieldNullFlag(CTHANDLE Handle, CTBOOL flag)


  • Handle [in] the Field Handle which specifies the column to change.
  • flag [in] the null flag value.

The c-treeDB API null flag controls the NOT NULL property of a column. Setting this column property has no effect on individual record null values: it is NOT enforced at the c-treeDB API 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.

Note: this is a schema change for an entire column and has nothing to do with individual records from the table. See ctdbIsNullField and ctdbClearField to edit NULL values of single fields in single records. This schema change works as follows: a TRUE Null Flag sets / enables the SQL “NOT NULL” property of the column, which means that that column is not allowed to have NULL values. A FALSE Null Flag disables the SQL “NOT NULL” property of the column, which means that that column is allowed to have NULL values.


ctdbSetFieldNullFlag() returns CTDBRET_OK on success, or a c-treeDB API C API error code on failure.

See also