Skip to content

DF_DRIVER_CONNECTION_ID_OPTIONS

The options for a DataFlex connection.

Level

Driver

Supported by

The DataFlex SQL Drivers (SQL Server, DB2, and ODBC), revision 5 and higher.

Type

Integer, temporary

Access

Read Only

Values

  • 0
  • 1

Syntax

Use cli.pkg
Get_Attribute DF_DRIVER_CONNECTION_ID_OPTIONS of {driverNumber} to {IntegerVariable}

Driver Configuration Keyword

None

Remarks

We introduced a new concept to define a connection, the "DataFlex connection ID". This provides a way to give a connection string a logical identification. When specifying the connection, the logical identification is used rather than the actual connection string. This allows a setup where a program using the same set of tables in multiple databases can have only one set of intermediate files. See DataFlex Connection IDs for more information.

Sample Code

Function DriverIndex String sDriver Returns Integer
    String sCurrentDriver
    Integer iNumberOfDrivers iDriver iCount
    Move 0 to iDriver
    Get_Attribute DF_NUMBER_DRIVERS to iNumberOfDrivers
    For iCount From 1 To iNumberOfDrivers
        Get_Attribute DF_DRIVER_NAME of iCount To sCurrentDriver
        If (Uppercase(sCurrentDriver) = Uppercase(sDriver)) Begin
            Move iCount to iDriver
        End
    Loop
    Function_Return iDriver
End_Function // DriverIndex

Procedure ShowConnectionIDs
    Integer iDriver iNumConn iConn iConnOptions
    String sID sConnString
    Get DriverIndex "MSSQLDRV" to iDriver
    If (iDriver = 0) Begin
        Showln "Driver not loaded"
        Procedure_Return
    End
    Get_Attribute DF_DRIVER_NUMBER_CONNECTION_IDS of iDriver to iNumConn
    Showln "Number of connection ids: " iNumConn
    For iConn From 0 to (iNumConn - 1)
        Get_Attribute DF_DRIVER_CONNECTION_ID of iDriver iConn to sID
        Get_Attribute DF_DRIVER_CONNECTION_ID_STRING of iDriver iConn to sConnString
        Get_Attribute DF_DRIVER_CONNECTION_ID_OPTIONS of iDriver iConn to iConnOptions
        Showln sID ", " sConnString ", " iConnOptions
    Loop
End_Procedure

The sample code above shows the currently defined connection IDs for a given driver.