DF_FILE_PRIMARY_INDEX¶

Applies to: ORAFlex SQLFlex MYSQLFlex PGFlex DB2Flex

This attribute gets or sets the index which is used as the primary key for a table. The variable used for this attribute is an integer containing the numbered index used. Getting the value of this attribute can be done at any time, whereas setting can only be done at table creation or during a Structure_Start. If a RECNUM is used as the unique identifier then 0 is returned.

Note: In Postgres this attribute is ReadOnly, so it can only be used to get the index used as the primary key.

Syntax

Get_Attribute DF_FILE_PRIMARY_INDEX of {FileNumber} to {variable}
Set_Attribute DF_FILE_PRIMARY_INDEX of {FileNumber} to {variable}

Parameter

Description

FileNumber

Number of the file

variable

Boolean variable indicating if a primary key is used

Example

Open Customer

Boolean bPrimary
Handle hFile

Move Customer.File_Number to hFile

Structure_Start hFile "ORA_DRV"
    Set_Attribute DF_FILE_PRIMARY_INDEX of Customer.File_Number to False
    Get_Attribute DF_FILE_PRIMARY_INDEX of Customer.File_Number to bPrimary
Structure_End hFile DF_STRUCTEND_OPT_NONE "." 0