DriverIndex - cConnection

Returns the index for a loaded driver

Type: Function

Return Data Type: Integer

Parameters: String sDriver

ParameterDescription
sDriverDriver Name


Return Value

Index for a loaded driver


Syntax
Function DriverIndex String sDriver Returns Integer

Call: Get DriverIndex sDriver to IntegerVariable


Description

Driver Index returns the index for a loaded driver. All loaded drivers, managed and unmanaged, have a driver index.

The driver name can be one of the below options.

ConstantMeaning
MSSQLDRVThe Data Access MS SQL driver
ODBC_DRVThe Data Access ODBC driver
DB2_DRVThe Data Access DB2 driver
DATAFLEXThe embedded database

If you are using a third party driver, consult the driver documentation for the name.

Sample

THis sample shows how to get the driver index and then use it to query a driver database API attribute.

Procedure ShowDriverAttribute
    Boolean bAttribValue
    Integer iDriver
 
    Get DriverIndex "MSSQLDRV" to iDriver
    Get_Attribute DF_DRIVER_USE_CACHE of iDriver to bAttribValue      

    Showln "Use cache: " (If(bAttribValue, "YES", "NO"))
End_Procedure


A loaded driver may not be registered. This might happen if the driver does support managed connections or a pre-loaded driver has not yet been registered. You can use the DriverCLIHandler method to determine if a driver is registered.

The DriverIndex can be used to communicate with the driver API interface. The DF_DRIVER_xxx API interfaces requires that you pass a driver number. DriverIndex returns that number.