Skip to content

DF_FILE_HANDLE_TYPE

See Also: Get_Attribute, Set_Attribute

The type of a table handle.

Level

Table

Supported by

All Drivers

Type

Enumeration list, temporary

Access

Read Only

Values

  • DF_FILE_HANDLE_BAD
  • DF_FILE_HANDLE_CLOSED
  • DF_FILE_HANDLE_OPENED
  • DF_FILE_HANDLE_EXISTING_RESTRUCTURE
  • DF_FILE_HANDLE_NEW_RESTRUCTURE

Remarks

This attribute indicates the type of the handle. If the file handle is invalid, the attribute's value will be DF_FILE_HANDLE_BAD. The value will be DF_FILE_HANDLE_CLOSED or DF_FILE_HANDLE_OPENED, respectively, for an unopened file and a file opened with open.

When restructuring an existing table, there are two table handles: the handle that points to the original table and the one that points to the table that is being restructured. A code fragment that shows two such handles is shown below:

Handle hTable
Handle hStruct
Open hTable Mode DF_EXCLUSIVE
Move hTable To hStruct
Structure_Start hStruct

The value of the DF_FILE_HANDLE_TYPE for hTable will be DF_FILE_HANDLE_OPENED, and the value for hStruct will be DF_FILE_HANDLE_EXISTING_RESTRUCTURE.

When creating a new table, there will be one handle that points to the table to be created. A code fragment that shows such a handle to create a Pervasive.SQL table is shown below:

Handle hStruct
Structure_Start hStruct "DFBTRDRV"

The value of the DF_FILE_HANDLE_TYPE for hStruct will be DF_FILE_HANDLE_NEW_RESTRUCTURE.

Procedure ShowHandleTypes
    Handle hTable
    Integer iHandleType
    Repeat
        Get_Attribute DF_FILE_NEXT_USED Of hTable To hTable
        If (hTable <> 0) Begin
            Get_Attribute DF_FILE_HANDLE_TYPE Of hTable To iHandleType
            Case Begin
                Case (iHandleType = DF_FILE_HANDLE_BAD)
                    Showln hTable " BAD"
                Case Break
                Case (iHandleType = DF_FILE_HANDLE_CLOSED)
                    Showln hTable " CLOSED"
                Case Break
                Case (iHandleType = DF_FILE_HANDLE_OPENED)
                    Showln hTable " OPENED"
                Case Break
                Case (iHandleType = DF_FILE_HANDLE_EXISTING_RESTRUCTURE)
                    Showln hTable " EXISTING RESTRUCTURE"
                Case Break
                Case (iHandleType = DF_FILE_HANDLE_NEW_RESTRUCTURE)
                    Showln hTable " NEW RESTRUCTURE"
                Case Break
            Case End
        End
    Until (hTable = 0)
End_Procedure // ShowHandleTypes

The procedure above will show the value of DF_FILE_HANDLE_TYPE for every table defined in the filelist.