The following specification of SQLRemoveDriver is from the Microsoft ODBC SDK Reference.
SQLRemoveDriver changes or removes information about the driver from the ODBCINST.INI entry in the system information.BOOL SQLRemoveDriver ( LPCSTR lpszDriver, BOOL fRemoveDSN, LPDWORD lpdwUsageCount);
The name of the driver as registered in the ODBCINST.INI key of the system information.
The valid values are:
Remove DSNs associated with the driver specified in lpszDriver.
Do not remove DSNs associated with the driver specified in lpszDriver.
The usage count of the driver after this function has been called.
The function returns TRUE if it is successful, FALSE if it fails. If no entry exists in the system information when this function is called, the function returns FALSE.
When SQLRemoveDriver returns FALSE, an associated *pfErrorCode value may be obtained by calling SQLInstallerError.
The following table lists the *pfErrorCode values that can be returned by SQLInstallerError and explains each one in the context of this function.
SQLRemoveDriver complements the SQLInstallDriverEx function, and updates the component usage count in the system information. This function should only be called from a setup application.
SQLRemoveDriver will decrement the component usage count value by 1. If the component usage count goes to 0 then the following will occur:
- The SQLConfigDriver function with the ODBC_REMOVE_DRIVER option will be called. If the fRemoveDSN option is set to TRUE, the ConfigDSN function calls SQLRemoveDSNFromIni to remove all the data sources associated with the driver specified in lpszDriver. If the fRemoveDSN option is set to FALSE, the data sources will not be deleted.
- The driver entry in the system information will be removed. The driver entry is in the following system information location, under the driver name:HKEY_LOCAL_MACHINE
SQLRemoveDriver does not actually remove any files. The calling program is responsible for deleting files, and maintaining the file usage count. Only after both the component usage count and the file usage count have reached zero is a file physically deleted. Some files in a component can be deleted, and others not deleted, depending upon whether the files are used by other applications that have incremented the file usage count.
SQLRemoveDriver is also called as part of an upgrade process. If an application detects that it has to perform an upgrade, and it has previously installed the driver, then the driver should be removed, then reinstalled.
SQLRemoveDriver should first be called to decrement the component usage count, then SQLInstallDriverEx should then be called to increment the component usage count. The application setup program must physically replace the old files with the new files.
The file usage count will remain the same, and other applications that use the older version files will now use the newer version.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40