f2s_column_allow_null_state¶

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

set_attribute f2s_column_allow_null_state of {FileNumber} {FieldNumber} to {variable}
get_attribute f2s_column_allow_null_state of {FileNumber} {FieldNumber} to {variable}

Parameter

Description

FileNumber

Number of the file (filename.File_Number)

FieldNumber

Number of the field

variable

Boolean variable. If true, NULL values are allowed for that column. If false, NULL values are not allowed for that column.

Description

This attribute is used to get or set whether the column in the table will allow NULL values. When set to true, the column allows NULL values. When set to false, this column will not allow NULL values. Getting the attribute can be done anywhere in the code, however, setting the attribute must be done within a Structure_Start/Structure_End block.

Examples

get_attribute

//find out if the column on the SQL back end that cooresponds
//to the dataflex field Customer.State can be NULL
Boolean bCanBeNull
Integer iField

//use the DataFlex command Get_FieldNumber to get the field number for Customer.State
Get_FieldNumber Customer.State to iField

Get_Attribute DF_FIELD_NULL of Customer.File_Number iField to bCanBeNull
Showln (sFormat("Can be null is %1",bCanBeNull))

set_attribute

Boolean bCanBeNull
Integer iField
Handle hVendor


Get_FieldNumber vendor.Fax_Number to iField
Move vendor.File_Number to hVendor

Get_Attribute f2s_column_allow_null_state of hVendor iField to bCanBeNull
Showln (sFormat("Can be null is %1",bCanBeNull))

Structure_Start hVendor _f2s_ActiveDriver
  Set_Attribute f2s_column_allow_null_state of hVendor iField to (1-bCanBeNull)
Structure_End hVendor

Open Vendor
Move vendor.File_Number to hVendor
Get_Attribute f2s_column_allow_null_state of hVendor iField to bCanBeNull
Showln (sFormat("Can be null is %1",bCanBeNull))

Replaces: DF_FIELD_NULL