Skip to content

DF_FILE_DATABASE_ID

The handle to the database connection of the given table.

Level

Table

Supported by

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

Type

Handle, temporary

Access

Read Only

Values

Any valid handle

Syntax

Use cli.pkg
Get_Attribute DF_FILE_DATABASE_ID of {tableNumber} to {HandleVariable}

Remarks

This table attribute returns the handle to the database connection of the table. This handle can be used in subsequent manipulation of database-level attributes.

Example Procedures

The sample procedures below show all supported types in the database of a table.

Function DriverIndex String sDriver Returns Integer
    String sCurrentDriver
    Integer iDriver
    Integer iNumDrivers

    Get_Attribute DF_NUMBER_DRIVERS To iNumDrivers
    For iDriver From 1 To iNumDrivers
        Get_Attribute DF_DRIVER_NAME of iDriver to sCurrentDriver
        If (Uppercase(sDriver) = Uppercase(sCurrentDriver)) ;
            Function_Return iDriver
        Loop
    Function_Return 0
End_Function

Procedure ShowTypes Integer iDriver Handle hDatabase
    Integer iNumTypes iType iMaxSize
    String sTypeName sCreateParams
    Handle hTypeID
    Boolean bAutoinc bUnsigned

    Get_Attribute DF_DATABASE_NUMBER_TYPES of iDriver hDatabase to iNumTypes
    For iType from 0 to (iNumTypes - 1)
        Get_Attribute DF_DATABASE_TYPE_NAME of iDriver hDatabase iType to sTypeName
        Get_Attribute DF_DATABASE_TYPE_ID of iDriver hDatabase iType to hTypeID
        Get_Attribute DF_DATABASE_TYPE_AUTOINC of iDriver hDatabase iType to bAutoinc
        Get_Attribute DF_DATABASE_TYPE_UNSIGNED of iDriver hDatabase iType to bUnsigned
        Get_Attribute DF_DATABASE_TYPE_MAXSIZE of iDriver hDatabase iType to iMaxSize
        Get_Attribute DF_DATABASE_TYPE_CREATE_PARAMS of iDriver hDatabase iType to sCreateParams
        Showln "  " iType ", " sTypeName ", " hTypeID ", " (If(bAutoinc, "Auto Increment", "NO Auto Increment")) ", " ;
        (If(bUnsigned, "Unsigned", "Signed")) ", " iMaxSize ", " sCreateParams
    Loop
End_Procedure

Procedure ShowTableDBTypes Handle hTable
    Handle hDatabase
    String sDriver
    Integer iDriver

    Get_Attribute DF_FILE_DATABASE_ID of hTable to hDatabase
    Get_Attribute DF_FILE_DRIVER of hTable to sDriver
    Get DriverIndex sDriver To iDriver
    Send ShowDBTypes iDriver hDatabase
End_Procedure