Unload_Driver

See Also: Load_Driver

Purpose

Unloads a loaded database driver.

Syntax

Unload_Driver driverName

Where driverName is the name (string) of the database driver. The names of drivers available from Data Access Worldwide are:

What It Does

The Unload_Driver command unloads the specified driver from memory, which may release some system resources. It will also close any open files that use driver driverName.

Note that you do not need to use this command; if your program terminates without unloading drivers, you will not receive an error message.

Unload_Driver "MSSQLDRV"

In this example, all MS SQL tables are closed, all server connections for that driver are terminated, and the driver is deinitialized.

 

When a driver is unloaded, the number of drivers (DF_NUMBER_DRIVERS) is decremented immediately and all drivers numbered higher are automatically decremented. So this code does not work:

Integer iDriverCount iDriver

String sName

 

Get_Attribute DF_NUMBER_DRIVERS to iDriverCount

For iDriver From 1 to iDriverCount

    Get_Attribute DF_DRIVER_NAME of iDriver to sName

    If (sName <> "DATAFLEX") Begin

        Unload_Driver sName

    End

Loop

while this code does:

Integer iDriver iDrivers iDriverCount iDriversToUnload

String sName

String[] sDriversToUnload

 

Get_Attribute DF_NUMBER_DRIVERS to iDriverCount

For iDriver from 1 to iDriverCount

    Get_Attribute DF_DRIVER_NAME of iDriver to sName

    If (sName <> "DATAFLEX") Begin

        Move sName to sDriversToUnload[iDriversToUnload]

        Increment iDriversToUnload

    End

Loop

 

For iDriver from 0 to (iDriversToUnload-1)

    Unload_Driver sDriversToUnload[iDriver]

Loop

Notes