Skip to content

DF_INDEX_ON_BACKEND

Obsolete

DF_INDEX_ON_BACKEND has been replaced by DF_INDEX_SQL_TYPE. It remains as a read-only attribute for backward compatibility but should no longer be used.

Indicates whether the index is defined on the back end or not.

Level

Index

Supported by

The DataFlex SQL Drivers (SQL Server, DB2, and ODBC)

Type

Boolean, permanent

Access

Read only

Values

  • True
  • False

Syntax

Use cli.pkg
Get_Attribute DF_INDEX_ON_BACKEND of {tableNumber} {indexNumber} to {BooleanVariable}

Remarks

This attribute indicates whether the index is defined on the back end or not. It is possible to define indices on the “DataFlex side” that do not exist on the back end. Defining such an index is required when accessing a database view. DataFlex requires at least one unique index for every table it accesses. Since indices cannot be defined on views, they must be defined on the DataFlex side.

DataFlex side indices are defined in the intermediate file.

Procedure ShowBackendIndices Handle hTable
    Integer iLastIndex
    Integer iIndex
    String sIndex
    String sName
    Integer iNumSegments
    Integer iSegment
    Integer iColumn
    String sColumn
    Integer iCase
    Integer iDirection
    Boolean bOnBackEnd

    Get_Attribute DF_FILE_LAST_INDEX_NUMBER Of hTable To iLastIndex
    For iIndex From 1 To iLastIndex
        Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of hTable iIndex To iNumSegments
        If (iNumSegments > 0) Begin
            Get_Attribute DF_INDEX_NAME Of hTable iIndex To sName
            Get_Attribute DF_INDEX_ON_BACKEND Of hTable iIndex To bOnBackEnd
            Move "" To sIndex
            For iSegment From 1 To iNumSegments
                Get_Attribute DF_INDEX_SEGMENT_FIELD Of hTable iIndex iSegment To iColumn
                Get_Attribute DF_FIELD_NAME Of hTable iColumn To sColumn
                Get_Attribute DF_INDEX_SEGMENT_CASE Of hTable iIndex iSegment To iCase
                If (iCase = DF_CASE_IGNORED) ;
                    Move (sColumn * "uppercased") To sColumn
                Get_Attribute DF_INDEX_SEGMENT_DIRECTION Of hTable iIndex iSegment To iDirection
                If (iDirection = DF_DESCENDING) ;
                    Move (sColumn * "descending") To sColumn
                If (iSegment > 1) ;
                    Move (sIndex + ",") To sIndex
                Move (sIndex * sColumn) To sIndex
            Loop
            Showln "   Index  " sName " (" sIndex ")" (If(bOnBackEnd, "", " on DataFlex side"))
        End
    Loop
    If (iLastIndex = 0) ;
        Showln "   NO index defined."
End_Procedure // ShowBackendIndices

The sample procedure above shows all indices defined on the given table. If the index is defined on the DataFlex side, this is displayed.