GDAL
Public Member Functions | Static Public Member Functions | List of all members
CPLODBCDriverInstaller Class Reference

A class providing functions to install or remove ODBC driver. More...

#include <cpl_odbc.h>

Public Member Functions

int InstallDriver (const char *pszDriver, const char *pszPathIn, WORD fRequest=ODBC_INSTALL_COMPLETE)
 Installs ODBC driver or updates definition of already installed driver.
 
int RemoveDriver (const char *pszDriverName, int fRemoveDSN=FALSE)
 Removes or changes information about the driver from the Odbcinst.ini entry in the system information.
 
int GetUsageCount () const
 The usage count of the driver after this function has been called.
 
const char * GetPathOut () const
 Path of the target directory where the driver should be installed.
 
const char * GetLastError () const
 If InstallDriver returns FALSE, then GetLastError then error message can be obtained by calling this function.
 
DWORD GetLastErrorCode () const
 If InstallDriver returns FALSE, then GetLastErrorCode then error code can be obtained by calling this function.
 

Static Public Member Functions

static void InstallMdbToolsDriver ()
 Attempts to install the MDB Tools driver for Microsoft Access databases.
 

Detailed Description

A class providing functions to install or remove ODBC driver.

Member Function Documentation

◆ GetLastError()

const char * CPLODBCDriverInstaller::GetLastError ( ) const
inline

If InstallDriver returns FALSE, then GetLastError then error message can be obtained by calling this function.

Internally, it calls ODBC's SQLInstallerError function.

◆ GetLastErrorCode()

DWORD CPLODBCDriverInstaller::GetLastErrorCode ( ) const
inline

If InstallDriver returns FALSE, then GetLastErrorCode then error code can be obtained by calling this function.

Internally, it calls ODBC's SQLInstallerError function. See ODBC API Reference for possible error flags.

◆ GetPathOut()

const char * CPLODBCDriverInstaller::GetPathOut ( ) const
inline

Path of the target directory where the driver should be installed.

For details, see ODBC API Reference and lpszPathOut parameter of SQLInstallDriverEx

◆ InstallDriver()

int CPLODBCDriverInstaller::InstallDriver ( const char *  pszDriver,
const char *  pszPathIn,
WORD  fRequest = ODBC_INSTALL_COMPLETE 
)

Installs ODBC driver or updates definition of already installed driver.

Interanally, it calls ODBC's SQLInstallDriverEx function.

Parameters
pszDriver- The driver definition as a list of keyword-value pairs describing the driver (See ODBC API Reference).
pszPathIn- Full path of the target directory of the installation, or a null pointer (for unixODBC, NULL is passed).
fRequest- The fRequest argument must contain one of the following values: ODBC_INSTALL_COMPLETE - (default) complete the installation request ODBC_INSTALL_INQUIRY - inquire about where a driver can be installed
Returns
TRUE indicates success, FALSE if it fails.

◆ InstallMdbToolsDriver()

void CPLODBCDriverInstaller::InstallMdbToolsDriver ( )
static

Attempts to install the MDB Tools driver for Microsoft Access databases.

This is only supported on non-Windows platforms.

Since
GDAL 3.4

◆ RemoveDriver()

int CPLODBCDriverInstaller::RemoveDriver ( const char *  pszDriverName,
int  fRemoveDSN = FALSE 
)

Removes or changes information about the driver from the Odbcinst.ini entry in the system information.

Parameters
pszDriverName- The name of the driver as registered in the Odbcinst.ini key of the system information.
fRemoveDSN- TRUE: Remove DSNs associated with the driver specified in lpszDriver. FALSE: Do not remove DSNs associated with the driver specified in lpszDriver.
Returns
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. In order to obtain usage count value, call GetUsageCount().

The documentation for this class was generated from the following files: