Skip to content

DriverIndex - cCLIHandler

Returns the index for a loaded driver

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
sDriver String Driver Name

Syntax

Function DriverIndex String sDriver Returns Integer

Call Example

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.

Constant Meaning
MSSQLDRV The Data Access MS SQL driver
ODBC_DRV The Data Access ODBC driver
DB2_DRV The Data Access DB2 driver
DATAFLEX The 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.

Function DriverIndex String sDriverId Returns Integer
    Integer iDriver

    Get psDriverId to sDriverId
    Forward Get DriverIndex sDriverId to iDriver

    Function_Return iDriver
End_Function

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.

Return Value

Index for a loaded driver