Configuring Null and Default Values for Conversion
DataFlex does not support null and defaults at the database level, so it is important to set up the null and default behavior correctly when converting. Since allowing nulls and default values are part of a table definition, it can be complicated to adjust these settings after conversion. For that reason, the SQL drivers allow the user to set up conversion defaults per type. These defaults are set up in an ASCII configuration file.
It is not necessary to use the configuration file. In case no configuration is present, the driver will use the following scheme:
| DATAFLEX TYPE | NULL ALLOWED | DEFAULT |
|---|---|---|
| Ascii | No | "" |
| Numeric | No | 0 |
| Date | No | 1753-01-01 |
| Text | No | "" |
| Binary | No | 0x0 |
Next to the default per type, the default table setting to use dummy zero dates can be set up through the configuration file. This can be done by setting DEFAULT_USE_DUMMY_ZERO_DATE. The default set for this configuration file setting will be used when creating a new table through a structure operation (when converting, for example).
For a detailed discussion of the driver configuration file, see Driver Configuration.
Recommendations
It is strongly recommended never to allow null values in any type of column. Sometimes it is required to use null values for a certain column. If this is needed, make sure that the column is never used as an index segment. The use of null values as index segments is supported, but it may yield unexpected results.
When converting existing DataFlex data, we strongly advise using the defaults for conversion. This means not allowing null values in any column and using dummy zero dates for every date column.