Command SET NULLVALUE Foundation

Enables/Disables NULL/NIL values for fields

Syntax
SET NULLVALUE ON | off | <lToggle>
Scope
thread-local, current work space
Parameters
<lToggle>
<lToggle> is logical expression which must appear in parentheses. Instead of the logical expression, the option ON can be specified for the value .T. (true) or OFF for the value .F. (false). When .T. or ON is specified, NULL values of any DatabaseEngine are represented with a NIL value on the Xbase++ language level. When .F. or OFF, NULL values are represented with an emtpy value of the corresponding data-type.
Description

The command SET NULLVALUE determines how NULL values are represented on the Xbase++ language level. When using SQL Database Systems it is often the case that some fields have NULL values enabled. However existing and traditional Xbase business logic assumes that a database field has an empty value in case no REPLACE operation has taken place.

With SET NULLVALUE OFF the traditional Xbase behaviour is automatically emulated by the Xbase++ database kernel. This is done automatically when reading from a database field. When data is read from a field any NULL value is masked by the empty value of the specific database fields type. SET NULLVALUE has no effect when data is written to a field.

The setting SET NULLVALUE ON|OFF affects only new work areas existing work areas are not affected by this setting. Using DbSetNullValue() for the current work area allows the programmer to dynamically enable/disable NULL value masking/transformation for the current work area.

The following table lists the empty values for each data type:

Empty values
Valtype() Data type Value
A array {} (array with length 0)
B code block no empty value
C character blank spaces, tabs, CRLF or null strings ("")
D date CtoD("") or CtoD(" / / ") (empty date)
L logical .F. (False)
N numeric 0
O object no empty value
U undefined NIL

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.