connectivity/Library_odbc.mk                                    |    2 
 connectivity/source/drivers/odbc/OConnection.cxx                |   50 
 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx |   46 
 connectivity/source/drivers/odbc/ODriver.cxx                    |  542 ++++++
 connectivity/source/drivers/odbc/OFunctions.cxx                 |  245 --
 connectivity/source/drivers/odbc/OPreparedStatement.cxx         |   20 
 connectivity/source/drivers/odbc/ORealDriver.cxx                |  291 ---
 connectivity/source/drivers/odbc/OResultSet.cxx                 |   62 
 connectivity/source/drivers/odbc/OResultSetMetaData.cxx         |    8 
 connectivity/source/drivers/odbc/OStatement.cxx                 |   26 
 connectivity/source/drivers/odbc/OTools.cxx                     |   22 
 connectivity/source/inc/odbc/OConnection.hxx                    |    3 
 connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx     |    5 
 connectivity/source/inc/odbc/ODriver.hxx                        |    6 
 connectivity/source/inc/odbc/OFunctions.hxx                     |  843 
+++-------
 connectivity/source/inc/odbc/OResultSet.hxx                     |    5 
 connectivity/source/inc/odbc/OResultSetMetaData.hxx             |    5 
 connectivity/source/inc/odbc/OStatement.hxx                     |    5 
 connectivity/source/inc/odbc/OTools.hxx                         |  106 -
 include/connectivity/odbc.hxx                                   |    4 
 20 files changed, 990 insertions(+), 1306 deletions(-)

New commits:
commit ed2d890d69b64c8f1f19914ef75fa8dcf08e6cbc
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 22 16:55:11 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jul 26 23:20:12 2024 +0200

    Refactor ODBC functions code for clarity
    
    Change-Id: I5f3de97fc178b11c82655f65435c637fdff65e99
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171080
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/connectivity/Library_odbc.mk b/connectivity/Library_odbc.mk
index b14412932083..9bc514c9d7d5 100644
--- a/connectivity/Library_odbc.mk
+++ b/connectivity/Library_odbc.mk
@@ -45,8 +45,6 @@ $(eval $(call gb_Library_use_libraries,odbc,\
 ))
 
 $(eval $(call gb_Library_add_exception_objects,odbc,\
-       connectivity/source/drivers/odbc/ORealDriver \
-       connectivity/source/drivers/odbc/OFunctions \
        connectivity/source/drivers/odbc/OPreparedStatement \
        connectivity/source/drivers/odbc/OStatement \
        connectivity/source/drivers/odbc/OResultSetMetaData \
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx 
b/connectivity/source/drivers/odbc/OConnection.cxx
index 996e735ac07c..70e2f782c97e 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -66,20 +66,20 @@ OConnection::~OConnection()
 
     if (!m_bClosed)
     {
-        rc = N3SQLDisconnect( m_aConnectionHandle );
+        rc = functions().Disconnect(m_aConnectionHandle);
         OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure 
from SQLDisconnect" );
     }
 
-    rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
+    rc = functions().FreeHandle(SQL_HANDLE_DBC, m_aConnectionHandle);
     OSL_ENSURE( rc == SQL_SUCCESS , "Failure from SQLFreeHandle for 
connection");
 
     m_aConnectionHandle = SQL_NULL_HANDLE;
 }
 
-oslGenericFunction OConnection::getOdbcFunction(ODBC3SQLFunctionId _nIndex)  
const
+const Functions& OConnection::functions() const
 {
     OSL_ENSURE(m_xDriver, "OConnection::getOdbcFunction: m_xDriver is null!");
-    return m_xDriver->getOdbcFunction(_nIndex);
+    return m_xDriver->functions();
 }
 
 SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 
nTimeOut, bool bSilent)
@@ -97,14 +97,14 @@ SQLRETURN OConnection::OpenConnection(const OUString& 
aConnectStr, sal_Int32 nTi
     memcpy(szConnStrIn, aConStr.getStr(), 
std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength()));
 
 #ifndef MACOSX
-    
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(nTimeOut)),SQL_IS_UINTEGER);
+    
functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(nTimeOut)),SQL_IS_UINTEGER);
 #else
     (void)nTimeOut; /* WaE */
 #endif
 
 #ifdef LINUX
     (void) bSilent;
-    nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
+    nSQLRETURN = functions().DriverConnect(m_aConnectionHandle,
                       nullptr,
                       szConnStrIn,
                       
static_cast<SQLSMALLINT>(std::min(sal_Int32(2048),aConStr.getLength())),
@@ -117,7 +117,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& 
aConnectStr, sal_Int32 nTi
 #else
 
     SQLUSMALLINT nSilent =  bSilent ? SQL_DRIVER_NOPROMPT : 
SQL_DRIVER_COMPLETE;
-    nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
+    nSQLRETURN = functions().DriverConnect(m_aConnectionHandle,
                       nullptr,
                       szConnStrIn,
                       
static_cast<SQLSMALLINT>(std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength())),
@@ -156,7 +156,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& 
aConnectStr, sal_Int32 nTi
     // autocommit is always default
 
     if (!m_bReadOnly)
-        N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT, 
reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON),SQL_IS_INTEGER);
+        functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT, 
reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON),SQL_IS_INTEGER);
 
     return nSQLRETURN;
 }
@@ -167,7 +167,7 @@ SQLRETURN OConnection::Construct(const OUString& url,const 
Sequence< PropertyVal
     m_sURL  = url;
     setConnectionInfo(info);
 
-    N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
+    
functions().AllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
     if(m_aConnectionHandle == SQL_NULL_HANDLE)
         throw SQLException();
 
@@ -301,7 +301,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& 
sql )
     OString aSql(OUStringToOString(sql,getTextEncoding()));
     char pOut[2048];
     SQLINTEGER nOutLen;
-    
OTools::ThrowException(this,N3SQLNativeSql(m_aConnectionHandle,reinterpret_cast<SDB_ODBC_CHAR
 *>(const_cast<char 
*>(aSql.getStr())),aSql.getLength(),reinterpret_cast<SDB_ODBC_CHAR*>(pOut),sizeof
 pOut - 1,&nOutLen),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+    
OTools::ThrowException(this,functions().NativeSql(m_aConnectionHandle,reinterpret_cast<SDB_ODBC_CHAR
 *>(const_cast<char 
*>(aSql.getStr())),aSql.getLength(),reinterpret_cast<SDB_ODBC_CHAR*>(pOut),sizeof
 pOut - 1,&nOutLen),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
     return OUString(pOut,nOutLen,getTextEncoding());
 }
 
@@ -311,7 +311,7 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool 
autoCommit )
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
     const sal_IntPtr nAutocommit = autoCommit ? SQL_AUTOCOMMIT_ON : 
SQL_AUTOCOMMIT_OFF;
-    OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
+    OTools::ThrowException(this,functions().SetConnectAttr(m_aConnectionHandle,
                                    SQL_ATTR_AUTOCOMMIT,
                                    reinterpret_cast<SQLPOINTER>(nAutocommit) 
,SQL_IS_INTEGER),
                                    m_aConnectionHandle,SQL_HANDLE_DBC,*this);
@@ -324,7 +324,7 @@ sal_Bool SAL_CALL OConnection::getAutoCommit(  )
 
 
     sal_uInt32 nOption = 0;
-    OTools::ThrowException(this,N3SQLGetConnectAttr(m_aConnectionHandle,
+    OTools::ThrowException(this,functions().GetConnectAttr(m_aConnectionHandle,
                                    SQL_ATTR_AUTOCOMMIT, 
&nOption,0,nullptr),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
     return nOption == SQL_AUTOCOMMIT_ON ;
 }
@@ -335,7 +335,7 @@ void SAL_CALL OConnection::commit(  )
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
 
-    
OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+    
OTools::ThrowException(this,functions().EndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
 void SAL_CALL OConnection::rollback(  )
@@ -344,7 +344,7 @@ void SAL_CALL OConnection::rollback(  )
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
 
-    
OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+    
OTools::ThrowException(this,functions().EndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
 sal_Bool SAL_CALL OConnection::isClosed(  )
@@ -376,7 +376,7 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly )
 
 
     OTools::ThrowException(this,
-        
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,reinterpret_cast< 
SQLPOINTER >( readOnly ),SQL_IS_INTEGER),
+        
functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,reinterpret_cast<
 SQLPOINTER >( readOnly ),SQL_IS_INTEGER),
         m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
@@ -394,7 +394,7 @@ void SAL_CALL OConnection::setCatalog( const OUString& 
catalog )
 
     OString aCat(OUStringToOString(catalog,getTextEncoding()));
     OTools::ThrowException(this,
-        
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,const_cast<char
 *>(aCat.getStr()),SQL_NTS),
+        
functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,const_cast<char
 *>(aCat.getStr()),SQL_NTS),
         m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
@@ -407,7 +407,7 @@ OUString SAL_CALL OConnection::getCatalog(  )
     SQLINTEGER nValueLen;
     char pCat[1024];
     OTools::ThrowException(this,
-        
N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,pCat,(sizeof 
pCat)-1,&nValueLen),
+        
functions().GetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,pCat,(sizeof
 pCat)-1,&nValueLen),
         m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 
     return OUString(pCat,nValueLen,getTextEncoding());
@@ -419,7 +419,7 @@ void SAL_CALL OConnection::setTransactionIsolation( 
sal_Int32 level )
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
 
-    OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
+    OTools::ThrowException(this,functions().SetConnectAttr(m_aConnectionHandle,
                                    SQL_ATTR_TXN_ISOLATION,
                                    
reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(level)),SQL_IS_INTEGER),
                                    m_aConnectionHandle,SQL_HANDLE_DBC,*this);
@@ -434,7 +434,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation(  )
     sal_Int32 nTxn = 0;
     SQLINTEGER nValueLen;
     OTools::ThrowException(this,
-        
N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof 
nTxn,&nValueLen),
+        
functions().GetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof
 nTxn,&nValueLen),
         m_aConnectionHandle,SQL_HANDLE_DBC,*this);
     return nTxn;
 }
@@ -486,7 +486,7 @@ void OConnection::disposing()
     m_aConnections.clear();
 
     if(!m_bClosed)
-        N3SQLDisconnect(m_aConnectionHandle);
+        functions().Disconnect(m_aConnectionHandle);
     m_bClosed   = true;
 }
 
@@ -510,7 +510,7 @@ SQLHANDLE OConnection::createStatementHandle()
     }
 
     SQLHANDLE aStatementHandle = SQL_NULL_HANDLE;
-    
N3SQLAllocHandle(SQL_HANDLE_STMT,xConnectionTemp->getConnection(),&aStatementHandle);
+    
functions().AllocHandle(SQL_HANDLE_STMT,xConnectionTemp->getConnection(),&aStatementHandle);
     ++m_nStatementCount;
     if(bNew)
         m_aConnections.emplace(aStatementHandle,xConnectionTemp);
@@ -526,10 +526,10 @@ void OConnection::freeStatementHandle(SQLHANDLE& _pHandle)
 
     auto aFind = m_aConnections.find(_pHandle);
 
-    N3SQLFreeStmt(_pHandle,SQL_RESET_PARAMS);
-    N3SQLFreeStmt(_pHandle,SQL_UNBIND);
-    N3SQLFreeStmt(_pHandle,SQL_CLOSE);
-    N3SQLFreeHandle(SQL_HANDLE_STMT,_pHandle);
+    functions().FreeStmt(_pHandle,SQL_RESET_PARAMS);
+    functions().FreeStmt(_pHandle,SQL_UNBIND);
+    functions().FreeStmt(_pHandle,SQL_CLOSE);
+    functions().FreeHandle(SQL_HANDLE_STMT,_pHandle);
 
     _pHandle = SQL_NULL_HANDLE;
 
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx 
b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
index c8c8ac68f9f5..665f94b95181 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -495,7 +495,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first(  )
 
     m_bEOF = false;
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState 
== SQL_SUCCESS_WITH_INFO );
     if( bRet )
@@ -510,7 +510,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last(  )
     ::osl::MutexGuard aGuard( m_aMutex );
 
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     // here I know definitely that I stand on the last record
     bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState 
== SQL_SUCCESS_WITH_INFO );
@@ -527,7 +527,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( 
sal_Int32 row )
 
     m_bEOF = false;
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == 
SQL_SUCCESS_WITH_INFO;
     if(bRet)
@@ -543,7 +543,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( 
sal_Int32 row )
 
     m_bEOF = false;
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == 
SQL_SUCCESS_WITH_INFO;
     if(bRet)
@@ -559,7 +559,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous(  )
 
     m_bEOF = false;
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == 
SQL_SUCCESS_WITH_INFO;
     if(bRet)
@@ -625,8 +625,8 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next(  )
     m_bEOF = false;
 
     SQLRETURN nOldFetchStatus = m_nCurrentFetchState;
-    //  m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
-    m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
+    //  m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
+    m_nCurrentFetchState = functions().Fetch(m_aStatementHandle);
     
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == 
SQL_SUCCESS_WITH_INFO;
     if(bRet || ( m_nCurrentFetchState == SQL_NO_DATA && nOldFetchStatus != 
SQL_NO_DATA ) )
@@ -661,7 +661,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::cancel(  )
     ::osl::MutexGuard aGuard( m_aMutex );
 
 
-    N3SQLCancel(m_aStatementHandle);
+    functions().Cancel(m_aStatementHandle);
 }
 
 void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings(  )
@@ -826,7 +826,7 @@ void ODatabaseMetaDataResultSet::openTypeInfo()
 
     m_aValueRange[2] = aMap;
 
-    
OTools::ThrowException(m_pConnection.get(),N3SQLGetTypeInfo(m_aStatementHandle, 
SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    
OTools::ThrowException(m_pConnection.get(),functions().GetTypeInfo(m_aStatementHandle,
 SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
     checkColumnCount();
 }
 
@@ -868,7 +868,7 @@ void ODatabaseMetaDataResultSet::openTables(const Any& 
catalog, const OUString&
     else
         pCOL = SQL_ALL_TABLE_TYPES;
 
-    SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Tables(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -880,7 +880,7 @@ void ODatabaseMetaDataResultSet::openTables(const Any& 
catalog, const OUString&
 
 void ODatabaseMetaDataResultSet::openTablesTypes( )
 {
-    SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Tables(m_aStatementHandle,
                             nullptr,0,
                             nullptr,0,
                             nullptr,0,
@@ -896,7 +896,7 @@ void ODatabaseMetaDataResultSet::openTablesTypes( )
 
 void ODatabaseMetaDataResultSet::openCatalogs()
 {
-    SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Tables(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(SQL_ALL_CATALOGS)),SQL_NTS,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>("")),SQL_NTS,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>("")),SQL_NTS,
@@ -913,7 +913,7 @@ void ODatabaseMetaDataResultSet::openCatalogs()
 
 void ODatabaseMetaDataResultSet::openSchemas()
 {
-    SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Tables(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>("")),SQL_NTS,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(SQL_ALL_SCHEMAS)),SQL_NTS,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>("")),SQL_NTS,
@@ -952,7 +952,7 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges(  
const Any& catalog, cons
                 *pCOL = aCOL.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().ColumnPrivileges(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -985,7 +985,7 @@ void ODatabaseMetaDataResultSet::openColumns(   const Any& 
catalog,
                 *pCOL = aCOL.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Columns(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -1052,7 +1052,7 @@ void ODatabaseMetaDataResultSet::openProcedureColumns(  
const Any& catalog,
                 *pCOL = aCOL.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().ProcedureColumns(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -1084,7 +1084,7 @@ void ODatabaseMetaDataResultSet::openProcedures(const 
Any& catalog, const OUStri
                 *pPKN = aPKN.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Procedures(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS);
@@ -1123,7 +1123,7 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool 
_bRowVer,const Any& cat
                 *pPKN = aPKN.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? 
SQL_ROWVER : SQL_BEST_ROWID,
+    SQLRETURN nRetcode = 
functions().SpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : 
SQL_BEST_ROWID,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -1183,7 +1183,7 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const 
Any& catalog, const OUSt
         pFKN = aFKN.getStr();
     }
 
-    SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().ForeignKeys(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), pPKN ? SQL_NTS : 0,
@@ -1230,7 +1230,7 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const 
Any& catalog, const OUStr
                 *pPKN = aPKN.getStr();
 
 
-    SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().PrimaryKeys(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS);
@@ -1259,7 +1259,7 @@ void 
ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const O
                 *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && 
!aPKO.isEmpty() ? aPKO.getStr() : nullptr,
                 *pPKN = aPKN.getStr();
 
-    SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().TablePrivileges(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS);
@@ -1288,7 +1288,7 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const 
Any& catalog, const OUStri
                 *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && 
!aPKO.isEmpty() ? aPKO.getStr() : nullptr,
                 *pPKN = aPKN.getStr();
 
-    SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle,
+    SQLRETURN nRetcode = functions().Statistics(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKO)), pPKO ? SQL_NTS : 0 ,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char 
*>(pPKN)), SQL_NTS,
@@ -1301,7 +1301,7 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const 
Any& catalog, const OUStri
 void ODatabaseMetaDataResultSet::checkColumnCount()
 {
     sal_Int16 nNumResultCols=0;
-    
OTools::ThrowException(m_pConnection.get(),N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    
OTools::ThrowException(m_pConnection.get(),functions().NumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
     m_nDriverColumnCount = nNumResultCols;
 }
 
diff --git a/connectivity/source/drivers/odbc/ODriver.cxx 
b/connectivity/source/drivers/odbc/ODriver.cxx
index 10f4eec6d5e4..520f1ace0e86 100644
--- a/connectivity/source/drivers/odbc/ODriver.cxx
+++ b/connectivity/source/drivers/odbc/ODriver.cxx
@@ -17,13 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <odbc/ODriver.hxx>
+#include <sal/config.h>
+
 #include <odbc/OConnection.hxx>
-#include <odbc/OTools.hxx>
+#include <odbc/ODriver.hxx>
+#include <resource/sharedresources.hxx>
+#include <strings.hrc>
+
 #include <connectivity/dbexception.hxx>
 #include <cppuhelper/supportsservice.hxx>
-#include <strings.hrc>
-#include <resource/sharedresources.hxx>
+#include <osl/module.h>
+
 #include <utility>
 
 using namespace connectivity::odbc;
@@ -35,7 +39,6 @@ using namespace com::sun::star::sdbc;
 ODBCDriver::ODBCDriver(css::uno::Reference< css::uno::XComponentContext > 
_xContext)
     :ODriver_BASE(m_aMutex)
     ,m_xContext(std::move(_xContext))
-    ,m_pDriverHandle(SQL_NULL_HANDLE)
 {
 }
 
@@ -82,13 +85,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const 
OUString& url, cons
     if ( ! acceptsURL(url) )
         return nullptr;
 
-    if(!m_pDriverHandle)
-    {
-        OUString aPath;
-        if(!EnvironmentHandle(aPath))
-            throw SQLException(aPath,*this,OUString(),1000,Any());
-    }
-    rtl::Reference<OConnection> pCon = new OConnection(m_pDriverHandle,this);
+    rtl::Reference<OConnection> pCon = new OConnection(EnvironmentHandle(), 
this);
     pCon->Construct(url,info);
     m_xConnections.push_back(WeakReferenceHelper(*pCon));
 
@@ -188,5 +185,526 @@ sal_Int32 SAL_CALL ODBCDriver::getMinorVersion(  )
     return 0;
 }
 
+// Implib definitions for ODBC-DLL/shared library:
+
+namespace
+{
+constinit oslGenericFunction 
pODBC3SQLFunctions[static_cast<size_t>(ODBC3SQLFunctionId::LAST)]{};
+
+bool LoadFunctions(oslModule pODBCso)
+{
+    auto load = [pODBCso](ODBC3SQLFunctionId id, const OUString& name)
+    {
+        assert(id > ODBC3SQLFunctionId::FIRST && id < 
ODBC3SQLFunctionId::LAST);
+        auto& rpFunc = pODBC3SQLFunctions[static_cast<size_t>(id)];
+        assert(rpFunc == nullptr);
+        rpFunc = osl_getFunctionSymbol(pODBCso, name.pData);
+        return rpFunc != nullptr;
+    };
+
+    return load(ODBC3SQLFunctionId::AllocHandle,      u"SQLAllocHandle"_ustr)
+        && load(ODBC3SQLFunctionId::DriverConnect,    u"SQLDriverConnect"_ustr)
+        && load(ODBC3SQLFunctionId::GetInfo,          u"SQLGetInfo"_ustr)
+        && load(ODBC3SQLFunctionId::GetFunctions,     u"SQLGetFunctions"_ustr)
+        && load(ODBC3SQLFunctionId::GetTypeInfo,      u"SQLGetTypeInfo"_ustr)
+        && load(ODBC3SQLFunctionId::SetConnectAttr,   
u"SQLSetConnectAttr"_ustr)
+        && load(ODBC3SQLFunctionId::GetConnectAttr,   
u"SQLGetConnectAttr"_ustr)
+        && load(ODBC3SQLFunctionId::SetEnvAttr,       u"SQLSetEnvAttr"_ustr)
+        && load(ODBC3SQLFunctionId::GetEnvAttr,       u"SQLGetEnvAttr"_ustr)
+        && load(ODBC3SQLFunctionId::SetStmtAttr,      u"SQLSetStmtAttr"_ustr)
+        && load(ODBC3SQLFunctionId::GetStmtAttr,      u"SQLGetStmtAttr"_ustr)
+        && load(ODBC3SQLFunctionId::Prepare,          u"SQLPrepare"_ustr)
+        && load(ODBC3SQLFunctionId::BindParameter,    u"SQLBindParameter"_ustr)
+        && load(ODBC3SQLFunctionId::SetCursorName,    u"SQLSetCursorName"_ustr)
+        && load(ODBC3SQLFunctionId::Execute,          u"SQLExecute"_ustr)
+        && load(ODBC3SQLFunctionId::ExecDirect,       u"SQLExecDirect"_ustr)
+        && load(ODBC3SQLFunctionId::DescribeParam,    u"SQLDescribeParam"_ustr)
+        && load(ODBC3SQLFunctionId::NumParams,        u"SQLNumParams"_ustr)
+        && load(ODBC3SQLFunctionId::ParamData,        u"SQLParamData"_ustr)
+        && load(ODBC3SQLFunctionId::PutData,          u"SQLPutData"_ustr)
+        && load(ODBC3SQLFunctionId::RowCount,         u"SQLRowCount"_ustr)
+        && load(ODBC3SQLFunctionId::NumResultCols,    u"SQLNumResultCols"_ustr)
+        && load(ODBC3SQLFunctionId::ColAttribute,     u"SQLColAttribute"_ustr)
+        && load(ODBC3SQLFunctionId::BindCol,          u"SQLBindCol"_ustr)
+        && load(ODBC3SQLFunctionId::Fetch,            u"SQLFetch"_ustr)
+        && load(ODBC3SQLFunctionId::FetchScroll,      u"SQLFetchScroll"_ustr)
+        && load(ODBC3SQLFunctionId::GetData,          u"SQLGetData"_ustr)
+        && load(ODBC3SQLFunctionId::SetPos,           u"SQLSetPos"_ustr)
+        && load(ODBC3SQLFunctionId::BulkOperations,   
u"SQLBulkOperations"_ustr)
+        && load(ODBC3SQLFunctionId::MoreResults,      u"SQLMoreResults"_ustr)
+        && load(ODBC3SQLFunctionId::GetDiagRec,       u"SQLGetDiagRec"_ustr)
+        && load(ODBC3SQLFunctionId::ColumnPrivileges, 
u"SQLColumnPrivileges"_ustr)
+        && load(ODBC3SQLFunctionId::Columns,          u"SQLColumns"_ustr)
+        && load(ODBC3SQLFunctionId::ForeignKeys,      u"SQLForeignKeys"_ustr)
+        && load(ODBC3SQLFunctionId::PrimaryKeys,      u"SQLPrimaryKeys"_ustr)
+        && load(ODBC3SQLFunctionId::ProcedureColumns, 
u"SQLProcedureColumns"_ustr)
+        && load(ODBC3SQLFunctionId::Procedures,       u"SQLProcedures"_ustr)
+        && load(ODBC3SQLFunctionId::SpecialColumns,   
u"SQLSpecialColumns"_ustr)
+        && load(ODBC3SQLFunctionId::Statistics,       u"SQLStatistics"_ustr)
+        && load(ODBC3SQLFunctionId::TablePrivileges,  
u"SQLTablePrivileges"_ustr)
+        && load(ODBC3SQLFunctionId::Tables,           u"SQLTables"_ustr)
+        && load(ODBC3SQLFunctionId::FreeStmt,         u"SQLFreeStmt"_ustr)
+        && load(ODBC3SQLFunctionId::CloseCursor,      u"SQLCloseCursor"_ustr)
+        && load(ODBC3SQLFunctionId::Cancel,           u"SQLCancel"_ustr)
+        && load(ODBC3SQLFunctionId::EndTran,          u"SQLEndTran"_ustr)
+        && load(ODBC3SQLFunctionId::Disconnect,       u"SQLDisconnect"_ustr)
+        && load(ODBC3SQLFunctionId::FreeHandle,       u"SQLFreeHandle"_ustr)
+        && load(ODBC3SQLFunctionId::GetCursorName,    u"SQLGetCursorName"_ustr)
+        && load(ODBC3SQLFunctionId::NativeSql,        u"SQLNativeSql"_ustr);
+}
+
+// Take care of Dynamically loading of the DLL/shared lib and Addresses:
+// Returns sal_True at success
+bool LoadLibrary_ODBC3(OUString &_rPath)
+{
+    static bool bLoaded = false;
+    static oslModule pODBCso = nullptr;
+
+    if (bLoaded)
+        return true;
+#ifdef DISABLE_DYNLOADING
+    (void)_rPath;
+#else
+#ifdef _WIN32
+    _rPath = "ODBC32.DLL";
+#endif
+#ifdef UNX
+ #ifdef MACOSX
+    _rPath = "libiodbc.dylib";
+ #else
+    _rPath = "libodbc.so.2";
+    pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+    if ( !pODBCso )
+    {
+        _rPath = "libodbc.so.1";
+        pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+    }
+    if ( !pODBCso )
+        _rPath = "libodbc.so";
+
+ #endif   /* MACOSX */
+#endif
+
+    if ( !pODBCso )
+        pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+#endif // DISABLE_DYNLOADING
+    if( !pODBCso)
+        return false;
+
+    bLoaded = LoadFunctions(pODBCso);
+    return bLoaded;
+}
+
+class ORealOdbcDriver : public connectivity::odbc::ODBCDriver, public 
connectivity::odbc::Functions
+{
+public:
+    explicit ORealOdbcDriver(const 
css::uno::Reference<css::uno::XComponentContext>& _rxContext)
+        : ODBCDriver(_rxContext)
+    {
+    }
+    const Functions& functions() const override { return *this; }
+
+    // Functions
+
+    bool has(ODBC3SQLFunctionId id) const override
+    {
+        assert(id > ODBC3SQLFunctionId::FIRST && id < 
ODBC3SQLFunctionId::LAST);
+        return pODBC3SQLFunctions[static_cast<size_t>(id)] != nullptr;
+    }
+
+    SQLRETURN AllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle,
+                          SQLHANDLE* OutputHandlePtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::AllocHandle, HandleType, 
InputHandle, OutputHandlePtr);
+    }
+
+    SQLRETURN DriverConnect(SQLHDBC ConnectionHandle, HWND WindowHandle,
+                            SQLCHAR* InConnectionString, SQLSMALLINT 
StringLength1,
+                            SQLCHAR* OutConnectionString, SQLSMALLINT 
BufferLength,
+                            SQLSMALLINT* StringLength2Ptr,
+                            SQLUSMALLINT DriverCompletion) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::DriverConnect, ConnectionHandle, 
WindowHandle,
+                        InConnectionString, StringLength1, 
OutConnectionString, BufferLength,
+                        StringLength2Ptr, DriverCompletion);
+    }
+
+    SQLRETURN GetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, 
SQLPOINTER InfoValuePtr,
+                      SQLSMALLINT BufferLength, SQLSMALLINT* StringLengthPtr) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetInfo, ConnectionHandle, 
InfoType, InfoValuePtr,
+                        BufferLength, StringLengthPtr);
+    }
+
+    SQLRETURN GetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId,
+                           SQLUSMALLINT* SupportedPtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetFunctions, ConnectionHandle, 
FunctionId,
+                        SupportedPtr);
+    }
+
+    SQLRETURN GetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetTypeInfo, StatementHandle, 
DataType);
+    }
+
+    SQLRETURN SetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                             SQLINTEGER StringLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SetConnectAttr, ConnectionHandle, 
Attribute, ValuePtr,
+                        StringLength);
+    }
+
+    SQLRETURN GetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                             SQLINTEGER BufferLength, SQLINTEGER* 
StringLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetConnectAttr, ConnectionHandle, 
Attribute, ValuePtr,
+                        BufferLength, StringLength);
+    }
+
+    SQLRETURN SetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                         SQLINTEGER StringLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SetEnvAttr, EnvironmentHandle, 
Attribute, ValuePtr,
+                        StringLength);
+    }
+
+    SQLRETURN GetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                         SQLINTEGER BufferLength, SQLINTEGER* StringLength) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetEnvAttr, EnvironmentHandle, 
Attribute, ValuePtr,
+                        BufferLength, StringLength);
+    }
+
+    SQLRETURN SetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                          SQLINTEGER StringLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SetStmtAttr, StatementHandle, 
Attribute, ValuePtr,
+                        StringLength);
+    }
+
+    SQLRETURN GetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, 
SQLPOINTER ValuePtr,
+                          SQLINTEGER BufferLength, SQLINTEGER* StringLength) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetStmtAttr, StatementHandle, 
Attribute, ValuePtr,
+                        BufferLength, StringLength);
+    }
+
+    SQLRETURN Prepare(SQLHSTMT StatementHandle, SQLCHAR* StatementText,
+                      SQLINTEGER TextLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Prepare, StatementHandle, 
StatementText, TextLength);
+    }
+
+    SQLRETURN BindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT 
ParameterNumber,
+                            SQLSMALLINT InputOutputType, SQLSMALLINT ValueType,
+                            SQLSMALLINT ParameterType, SQLULEN ColumnSize,
+                            SQLSMALLINT DecimalDigits, SQLPOINTER 
ParameterValuePtr,
+                            SQLLEN BufferLength, SQLLEN* StrLen_or_IndPtr) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::BindParameter, StatementHandle, 
ParameterNumber,
+                        InputOutputType, ValueType, ParameterType, ColumnSize, 
DecimalDigits,
+                        ParameterValuePtr, BufferLength, StrLen_or_IndPtr);
+    }
+
+    SQLRETURN SetCursorName(SQLHSTMT StatementHandle, SQLCHAR* CursorName,
+                            SQLSMALLINT NameLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SetCursorName, StatementHandle, 
CursorName, NameLength);
+    }
+
+    SQLRETURN Execute(SQLHSTMT StatementHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Execute, StatementHandle);
+    }
+
+    SQLRETURN ExecDirect(SQLHSTMT StatementHandle, SQLCHAR* StatementText,
+                         SQLINTEGER TextLength) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ExecDirect, StatementHandle, 
StatementText, TextLength);
+    }
+
+    SQLRETURN DescribeParam(SQLHSTMT StatementHandle, SQLUSMALLINT 
ParameterNumber,
+                            SQLSMALLINT* DataTypePtr, SQLULEN* 
ParameterSizePtr,
+                            SQLSMALLINT* DecimalDigitsPtr, SQLSMALLINT* 
NullablePtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::DescribeParam, StatementHandle, 
ParameterNumber,
+                        DataTypePtr, ParameterSizePtr, DecimalDigitsPtr, 
NullablePtr);
+    }
+
+    SQLRETURN NumParams(SQLHSTMT StatementHandle, SQLSMALLINT* 
ParameterCountPtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::NumParams, StatementHandle, 
ParameterCountPtr);
+    }
+
+    SQLRETURN ParamData(SQLHSTMT StatementHandle, SQLPOINTER* ValuePtrPtr) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ParamData, StatementHandle, 
ValuePtrPtr);
+    }
+
+    SQLRETURN PutData(SQLHSTMT StatementHandle, SQLPOINTER DataPtr,
+                      SQLLEN StrLen_or_Ind) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::PutData, StatementHandle, DataPtr, 
StrLen_or_Ind);
+    }
+
+    SQLRETURN RowCount(SQLHSTMT StatementHandle, SQLLEN* RowCountPtr) const 
override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::RowCount, StatementHandle, 
RowCountPtr);
+    }
+
+    SQLRETURN NumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT* 
ColumnCountPtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::NumResultCols, StatementHandle, 
ColumnCountPtr);
+    }
+
+    SQLRETURN ColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
+                           SQLUSMALLINT FieldIdentifier, SQLPOINTER 
CharacterAttributePtr,
+                           SQLSMALLINT BufferLength, SQLSMALLINT* 
StringLengthPtr,
+                           SQLLEN* NumericAttributePtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ColAttribute, StatementHandle, 
ColumnNumber,
+                        FieldIdentifier, CharacterAttributePtr, BufferLength, 
StringLengthPtr,
+                        NumericAttributePtr);
+    }
+
+    SQLRETURN BindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, 
SQLSMALLINT TargetType,
+                      SQLPOINTER TargetValuePtr, SQLLEN BufferLength,
+                      SQLLEN* StrLen_or_IndPtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::BindCol, StatementHandle, 
ColumnNumber, TargetType,
+                        TargetValuePtr, BufferLength, StrLen_or_IndPtr);
+    }
+
+    SQLRETURN Fetch(SQLHSTMT StatementHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Fetch, StatementHandle);
+    }
+
+    SQLRETURN FetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT 
FetchOrientation,
+                          SQLLEN FetchOffset) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::FetchScroll, StatementHandle, 
FetchOrientation,
+                        FetchOffset);
+    }
+
+    SQLRETURN GetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, 
SQLSMALLINT TargetType,
+                      SQLPOINTER TargetValuePtr, SQLLEN BufferLength,
+                      SQLLEN* StrLen_or_IndPtr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetData, StatementHandle, 
ColumnNumber, TargetType,
+                        TargetValuePtr, BufferLength, StrLen_or_IndPtr);
+    }
+
+    SQLRETURN SetPos(SQLHSTMT StatementHandle, SQLSETPOSIROW RowNumber, 
SQLUSMALLINT Operation,
+                     SQLUSMALLINT LockType) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SetPos, StatementHandle, 
RowNumber, Operation,
+                        LockType);
+    }
+
+    SQLRETURN BulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::BulkOperations, StatementHandle, 
Operation);
+    }
+
+    SQLRETURN MoreResults(SQLHSTMT StatementHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::MoreResults, StatementHandle);
+    }
+
+    SQLRETURN GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT 
RecNumber,
+                         SQLCHAR* Sqlstate, SQLINTEGER* NativeErrorPtr, 
SQLCHAR* MessageText,
+                         SQLSMALLINT BufferLength, SQLSMALLINT* TextLengthPtr) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetDiagRec, HandleType, Handle, 
RecNumber, Sqlstate,
+                        NativeErrorPtr, MessageText, BufferLength, 
TextLengthPtr);
+    }
+
+    SQLRETURN ColumnPrivileges(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+                               SQLSMALLINT NameLength1, SQLCHAR* SchemaName,
+                               SQLSMALLINT NameLength2, SQLCHAR* TableName, 
SQLSMALLINT NameLength3,
+                               SQLCHAR* ColumnName, SQLSMALLINT NameLength4) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ColumnPrivileges, StatementHandle, 
CatalogName,
+                        NameLength1, SchemaName, NameLength2, TableName, 
NameLength3, ColumnName,
+                        NameLength4);
+    }
+
+    SQLRETURN Columns(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, 
SQLSMALLINT NameLength1,
+                      SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* 
TableName,
+                      SQLSMALLINT NameLength3, SQLCHAR* ColumnName,
+                      SQLSMALLINT NameLength4) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Columns, StatementHandle, 
CatalogName, NameLength1,
+                        SchemaName, NameLength2, TableName, NameLength3, 
ColumnName, NameLength4);
+    }
+
+    SQLRETURN ForeignKeys(SQLHSTMT StatementHandle, SQLCHAR* PKCatalogName, 
SQLSMALLINT NameLength1,
+                          SQLCHAR* PKSchemaName, SQLSMALLINT NameLength2, 
SQLCHAR* PKTableName,
+                          SQLSMALLINT NameLength3, SQLCHAR* FKCatalogName, 
SQLSMALLINT NameLength4,
+                          SQLCHAR* FKSchemaName, SQLSMALLINT NameLength5, 
SQLCHAR* FKTableName,
+                          SQLSMALLINT NameLength6) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ForeignKeys, StatementHandle, 
PKCatalogName,
+                        NameLength1, PKSchemaName, NameLength2, PKTableName, 
NameLength3,
+                        FKCatalogName, NameLength4, FKSchemaName, NameLength5, 
FKTableName,
+                        NameLength6);
+    }
+
+    SQLRETURN PrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, 
SQLSMALLINT NameLength1,
+                          SQLCHAR* SchemaName, SQLSMALLINT NameLength2, 
SQLCHAR* TableName,
+                          SQLSMALLINT NameLength3) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::PrimaryKeys, StatementHandle, 
CatalogName, NameLength1,
+                        SchemaName, NameLength2, TableName, NameLength3);
+    }
+
+    SQLRETURN ProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+                               SQLSMALLINT NameLength1, SQLCHAR* SchemaName,
+                               SQLSMALLINT NameLength2, SQLCHAR* ProcName, 
SQLSMALLINT NameLength3,
+                               SQLCHAR* ColumnName, SQLSMALLINT NameLength4) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::ProcedureColumns, StatementHandle, 
CatalogName,
+                        NameLength1, SchemaName, NameLength2, ProcName, 
NameLength3, ColumnName,
+                        NameLength4);
+    }
+
+    SQLRETURN Procedures(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, 
SQLSMALLINT NameLength1,
+                         SQLCHAR* SchemaName, SQLSMALLINT NameLength2, 
SQLCHAR* ProcName,
+                         SQLSMALLINT NameLength3) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Procedures, StatementHandle, 
CatalogName, NameLength1,
+                        SchemaName, NameLength2, ProcName, NameLength3);
+    }
+
+    SQLRETURN SpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT 
IdentifierType,
+                             SQLCHAR* CatalogName, SQLSMALLINT NameLength1, 
SQLCHAR* SchemaName,
+                             SQLSMALLINT NameLength2, SQLCHAR* TableName, 
SQLSMALLINT NameLength3,
+                             SQLUSMALLINT Scope, SQLUSMALLINT Nullable) const 
override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::SpecialColumns, StatementHandle, 
IdentifierType,
+                        CatalogName, NameLength1, SchemaName, NameLength2, 
TableName, NameLength3,
+                        Scope, Nullable);
+    }
+
+    SQLRETURN Statistics(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, 
SQLSMALLINT NameLength1,
+                         SQLCHAR* SchemaName, SQLSMALLINT NameLength2, 
SQLCHAR* TableName,
+                         SQLSMALLINT NameLength3, SQLUSMALLINT Unique,
+                         SQLUSMALLINT Reserved) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Statistics, StatementHandle, 
CatalogName, NameLength1,
+                        SchemaName, NameLength2, TableName, NameLength3, 
Unique, Reserved);
+    }
+
+    SQLRETURN TablePrivileges(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+                              SQLSMALLINT NameLength1, SQLCHAR* SchemaName, 
SQLSMALLINT NameLength2,
+                              SQLCHAR* TableName, SQLSMALLINT NameLength3) 
const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::TablePrivileges, StatementHandle, 
CatalogName,
+                        NameLength1, SchemaName, NameLength2, TableName, 
NameLength3);
+    }
+
+    SQLRETURN Tables(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, 
SQLSMALLINT NameLength1,
+                     SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* 
TableName,
+                     SQLSMALLINT NameLength3, SQLCHAR* TableType,
+                     SQLSMALLINT NameLength4) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Tables, StatementHandle, 
CatalogName, NameLength1,
+                        SchemaName, NameLength2, TableName, NameLength3, 
TableType, NameLength4);
+    }
+
+    SQLRETURN FreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) const 
override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::FreeStmt, StatementHandle, Option);
+    }
+
+    SQLRETURN CloseCursor(SQLHSTMT StatementHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::CloseCursor, StatementHandle);
+    }
+
+    SQLRETURN Cancel(SQLHSTMT StatementHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Cancel, StatementHandle);
+    }
+
+    SQLRETURN EndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
+                      SQLSMALLINT CompletionType) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::EndTran, HandleType, Handle, 
CompletionType);
+    }
+
+    SQLRETURN Disconnect(SQLHDBC ConnectionHandle) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::Disconnect, ConnectionHandle);
+    }
+
+    SQLRETURN FreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) const 
override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::FreeHandle, HandleType, Handle);
+    }
+
+    SQLRETURN GetCursorName(SQLHSTMT StatementHandle, SQLCHAR* CursorName, 
SQLSMALLINT BufferLength,
+                            SQLSMALLINT* NameLength2) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::GetCursorName, StatementHandle, 
CursorName,
+                        BufferLength, NameLength2);
+    }
+
+    SQLRETURN NativeSql(SQLHDBC ConnectionHandle, SQLCHAR* InStatementText, 
SQLINTEGER TextLength1,
+                        SQLCHAR* OutStatementText, SQLINTEGER BufferLength,
+                        SQLINTEGER* TextLength2Ptr) const override
+    {
+        return ODBCFunc(ODBC3SQLFunctionId::NativeSql, ConnectionHandle, 
InStatementText,
+                        TextLength1, OutStatementText, BufferLength, 
TextLength2Ptr);
+    }
+
+protected:
+    virtual SQLHANDLE EnvironmentHandle() override;
+
+private:
+    template <typename... Args> static SQLRETURN ODBCFunc(ODBC3SQLFunctionId 
id, Args... args)
+    {
+        assert(id > ODBC3SQLFunctionId::FIRST && id < 
ODBC3SQLFunctionId::LAST);
+        assert(pODBC3SQLFunctions[static_cast<size_t>(id)]);
+        using Func_t = SQLRETURN(SQL_API*)(Args...);
+        return 
(*reinterpret_cast<Func_t>(pODBC3SQLFunctions[static_cast<size_t>(id)]))(args...);
+    }
+
+    SQLHANDLE m_pDriverHandle = SQL_NULL_HANDLE;
+};
+
+// ODBC Environment (common for all Connections):
+SQLHANDLE ORealOdbcDriver::EnvironmentHandle()
+{
+    // Is (for this instance) already an Environment made?
+    if (m_pDriverHandle == SQL_NULL_HANDLE)
+    {
+        OUString aPath;
+        SQLHANDLE h = SQL_NULL_HANDLE;
+        // allocate Environment
+        // load ODBC-DLL now:
+        if (!LoadLibrary_ODBC3(aPath)
+            || AllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &h) != SQL_SUCCESS)
+            dbtools::throwSQLException(aPath, OUString(), *this, 1000);
+
+        // Save in global Structure
+        m_pDriverHandle = h;
+        SetEnvAttr(h, SQL_ATTR_ODBC_VERSION, 
reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3),
+                   SQL_IS_UINTEGER);
+        //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) 
SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
+    }
+
+    return m_pDriverHandle;
+}
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_odbc_ORealOdbcDriver_get_implementation(css::uno::XComponentContext*
 context,
+                                                     
css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new ORealOdbcDriver(context));
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx 
b/connectivity/source/drivers/odbc/OFunctions.cxx
deleted file mode 100644
index 87bd726b3bee..000000000000
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ /dev/null
@@ -1,245 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <odbc/OFunctions.hxx>
-
-// Implib definitions for ODBC-DLL/shared library:
-
-namespace connectivity
-{
-    T3SQLAllocHandle pODBC3SQLAllocHandle;
-T3SQLConnect pODBC3SQLConnect;
-T3SQLDriverConnect pODBC3SQLDriverConnect;
-T3SQLBrowseConnect pODBC3SQLBrowseConnect;
-T3SQLDataSources pODBC3SQLDataSources;
-T3SQLDrivers pODBC3SQLDrivers;
-T3SQLGetInfo pODBC3SQLGetInfo;
-T3SQLGetFunctions pODBC3SQLGetFunctions;
-T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
-T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
-T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
-T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
-T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
-T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
-T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
-T3SQLPrepare pODBC3SQLPrepare;
-T3SQLBindParameter pODBC3SQLBindParameter;
-T3SQLSetCursorName pODBC3SQLSetCursorName;
-T3SQLExecute pODBC3SQLExecute;
-T3SQLExecDirect pODBC3SQLExecDirect;
-T3SQLDescribeParam pODBC3SQLDescribeParam;
-T3SQLNumParams pODBC3SQLNumParams;
-T3SQLParamData pODBC3SQLParamData;
-T3SQLPutData pODBC3SQLPutData;
-T3SQLRowCount pODBC3SQLRowCount;
-T3SQLNumResultCols pODBC3SQLNumResultCols;
-T3SQLDescribeCol pODBC3SQLDescribeCol;
-T3SQLColAttribute pODBC3SQLColAttribute;
-T3SQLBindCol pODBC3SQLBindCol;
-T3SQLFetch pODBC3SQLFetch;
-T3SQLFetchScroll pODBC3SQLFetchScroll;
-T3SQLGetData pODBC3SQLGetData;
-T3SQLSetPos pODBC3SQLSetPos;
-T3SQLBulkOperations pODBC3SQLBulkOperations;
-T3SQLMoreResults pODBC3SQLMoreResults;
-T3SQLGetDiagRec pODBC3SQLGetDiagRec;
-T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
-T3SQLColumns pODBC3SQLColumns;
-T3SQLForeignKeys pODBC3SQLForeignKeys;
-T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
-T3SQLProcedureColumns pODBC3SQLProcedureColumns;
-T3SQLProcedures pODBC3SQLProcedures;
-T3SQLSpecialColumns pODBC3SQLSpecialColumns;
-T3SQLStatistics pODBC3SQLStatistics;
-T3SQLTablePrivileges pODBC3SQLTablePrivileges;
-T3SQLTables pODBC3SQLTables;
-T3SQLFreeStmt pODBC3SQLFreeStmt;
-T3SQLCloseCursor pODBC3SQLCloseCursor;
-T3SQLCancel pODBC3SQLCancel;
-T3SQLEndTran pODBC3SQLEndTran;
-T3SQLDisconnect pODBC3SQLDisconnect;
-T3SQLFreeHandle pODBC3SQLFreeHandle;
-T3SQLGetCursorName pODBC3SQLGetCursorName;
-T3SQLNativeSql pODBC3SQLNativeSql;
-
-static bool LoadFunctions(oslModule pODBCso);
-
-// Take care of Dynamically loading of the DLL/shared lib and Addresses:
-// Returns sal_True at success
-bool LoadLibrary_ODBC3(OUString &_rPath)
-{
-    static bool bLoaded = false;
-    static oslModule pODBCso = nullptr;
-
-    if (bLoaded)
-        return true;
-#ifdef DISABLE_DYNLOADING
-    (void)_rPath;
-#else
-#ifdef _WIN32
-    _rPath = "ODBC32.DLL";
-#endif
-#ifdef UNX
- #ifdef MACOSX
-    _rPath = "libiodbc.dylib";
- #else
-    _rPath = "libodbc.so.2";
-    pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
-    if ( !pODBCso )
-    {
-        _rPath = "libodbc.so.1";
-        pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
-    }
-    if ( !pODBCso )
-        _rPath = "libodbc.so";
-
- #endif   /* MACOSX */
-#endif
-
-    if ( !pODBCso )
-        pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
-#endif // DISABLE_DYNLOADING
-    if( !pODBCso)
-        return false;
-
-    bLoaded = LoadFunctions(pODBCso);
-    return bLoaded;
-}
-
-
-bool LoadFunctions(oslModule pODBCso)
-{
-
-    if( ( pODBC3SQLAllocHandle  =   
reinterpret_cast<T3SQLAllocHandle>(osl_getFunctionSymbol(pODBCso, 
u"SQLAllocHandle"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLConnect      =   
reinterpret_cast<T3SQLConnect>(osl_getFunctionSymbol(pODBCso, 
u"SQLConnect"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLDriverConnect =  
reinterpret_cast<T3SQLDriverConnect>(osl_getFunctionSymbol(pODBCso, 
u"SQLDriverConnect"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLBrowseConnect =  
reinterpret_cast<T3SQLBrowseConnect>(osl_getFunctionSymbol(pODBCso, 
u"SQLBrowseConnect"_ustr.pData ))) == nullptr )
-        return false;
-    if(( pODBC3SQLDataSources   =   
reinterpret_cast<T3SQLDataSources>(osl_getFunctionSymbol(pODBCso, 
u"SQLDataSources"_ustr.pData ))) == nullptr )
-        return false;
-    if(( pODBC3SQLDrivers       =   
reinterpret_cast<T3SQLDrivers>(osl_getFunctionSymbol(pODBCso, 
u"SQLDrivers"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetInfo      =   
reinterpret_cast<T3SQLGetInfo>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetInfo"_ustr.pData ))) == nullptr )
-        return false;
-    if(( pODBC3SQLGetFunctions  =   
reinterpret_cast<T3SQLGetFunctions>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetFunctions"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetTypeInfo  =   
reinterpret_cast<T3SQLGetTypeInfo>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetTypeInfo"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSetConnectAttr = 
reinterpret_cast<T3SQLSetConnectAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLSetConnectAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetConnectAttr = 
reinterpret_cast<T3SQLGetConnectAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetConnectAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSetEnvAttr   =   
reinterpret_cast<T3SQLSetEnvAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLSetEnvAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetEnvAttr   =   
reinterpret_cast<T3SQLGetEnvAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetEnvAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSetStmtAttr  =   
reinterpret_cast<T3SQLSetStmtAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLSetStmtAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetStmtAttr  =   
reinterpret_cast<T3SQLGetStmtAttr>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetStmtAttr"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLPrepare      =   
reinterpret_cast<T3SQLPrepare>(osl_getFunctionSymbol(pODBCso, 
u"SQLPrepare"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLBindParameter =  
reinterpret_cast<T3SQLBindParameter>(osl_getFunctionSymbol(pODBCso, 
u"SQLBindParameter"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSetCursorName =  
reinterpret_cast<T3SQLSetCursorName>(osl_getFunctionSymbol(pODBCso, 
u"SQLSetCursorName"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLExecute      =   
reinterpret_cast<T3SQLExecute>(osl_getFunctionSymbol(pODBCso, 
u"SQLExecute"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLExecDirect   =   
reinterpret_cast<T3SQLExecDirect>(osl_getFunctionSymbol(pODBCso, 
u"SQLExecDirect"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLDescribeParam =  
reinterpret_cast<T3SQLDescribeParam>(osl_getFunctionSymbol(pODBCso, 
u"SQLDescribeParam"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLNumParams    =   
reinterpret_cast<T3SQLNumParams>(osl_getFunctionSymbol(pODBCso, 
u"SQLNumParams"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLParamData    =   
reinterpret_cast<T3SQLParamData>(osl_getFunctionSymbol(pODBCso, 
u"SQLParamData"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLPutData      =   
reinterpret_cast<T3SQLPutData>(osl_getFunctionSymbol(pODBCso, 
u"SQLPutData"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLRowCount     =   
reinterpret_cast<T3SQLRowCount>(osl_getFunctionSymbol(pODBCso, 
u"SQLRowCount"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLNumResultCols =  
reinterpret_cast<T3SQLNumResultCols>(osl_getFunctionSymbol(pODBCso, 
u"SQLNumResultCols"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLDescribeCol  =   
reinterpret_cast<T3SQLDescribeCol>(osl_getFunctionSymbol(pODBCso, 
u"SQLDescribeCol"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLColAttribute =   
reinterpret_cast<T3SQLColAttribute>(osl_getFunctionSymbol(pODBCso, 
u"SQLColAttribute"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLBindCol      =   
reinterpret_cast<T3SQLBindCol>(osl_getFunctionSymbol(pODBCso, 
u"SQLBindCol"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLFetch        =   
reinterpret_cast<T3SQLFetch>(osl_getFunctionSymbol(pODBCso, 
u"SQLFetch"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLFetchScroll  =   
reinterpret_cast<T3SQLFetchScroll>(osl_getFunctionSymbol(pODBCso, 
u"SQLFetchScroll"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetData      =   
reinterpret_cast<T3SQLGetData>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetData"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSetPos       =   
reinterpret_cast<T3SQLSetPos>(osl_getFunctionSymbol(pODBCso, 
u"SQLSetPos"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLBulkOperations = 
reinterpret_cast<T3SQLBulkOperations>(osl_getFunctionSymbol(pODBCso, 
u"SQLBulkOperations"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLMoreResults  =   
reinterpret_cast<T3SQLMoreResults>(osl_getFunctionSymbol(pODBCso, 
u"SQLMoreResults"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetDiagRec   =   
reinterpret_cast<T3SQLGetDiagRec>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetDiagRec"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLColumnPrivileges = 
reinterpret_cast<T3SQLColumnPrivileges>(osl_getFunctionSymbol(pODBCso, 
u"SQLColumnPrivileges"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLColumns      =   
reinterpret_cast<T3SQLColumns>(osl_getFunctionSymbol(pODBCso, 
u"SQLColumns"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLForeignKeys  =   
reinterpret_cast<T3SQLForeignKeys>(osl_getFunctionSymbol(pODBCso, 
u"SQLForeignKeys"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLPrimaryKeys  =   
reinterpret_cast<T3SQLPrimaryKeys>(osl_getFunctionSymbol(pODBCso, 
u"SQLPrimaryKeys"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLProcedureColumns = 
reinterpret_cast<T3SQLProcedureColumns>(osl_getFunctionSymbol(pODBCso, 
u"SQLProcedureColumns"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLProcedures   =   
reinterpret_cast<T3SQLProcedures>(osl_getFunctionSymbol(pODBCso, 
u"SQLProcedures"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLSpecialColumns = 
reinterpret_cast<T3SQLSpecialColumns>(osl_getFunctionSymbol(pODBCso, 
u"SQLSpecialColumns"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLStatistics   =   
reinterpret_cast<T3SQLStatistics>(osl_getFunctionSymbol(pODBCso, 
u"SQLStatistics"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLTablePrivileges = 
reinterpret_cast<T3SQLTablePrivileges>(osl_getFunctionSymbol(pODBCso, 
u"SQLTablePrivileges"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLTables       =   
reinterpret_cast<T3SQLTables>(osl_getFunctionSymbol(pODBCso, 
u"SQLTables"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLFreeStmt     =   
reinterpret_cast<T3SQLFreeStmt>(osl_getFunctionSymbol(pODBCso, 
u"SQLFreeStmt"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLCloseCursor  =   
reinterpret_cast<T3SQLCloseCursor>(osl_getFunctionSymbol(pODBCso, 
u"SQLCloseCursor"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLCancel       =   
reinterpret_cast<T3SQLCancel>(osl_getFunctionSymbol(pODBCso, 
u"SQLCancel"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLEndTran      =   
reinterpret_cast<T3SQLEndTran>(osl_getFunctionSymbol(pODBCso, 
u"SQLEndTran"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLDisconnect   =   
reinterpret_cast<T3SQLDisconnect>(osl_getFunctionSymbol(pODBCso, 
u"SQLDisconnect"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLFreeHandle   =   
reinterpret_cast<T3SQLFreeHandle>(osl_getFunctionSymbol(pODBCso, 
u"SQLFreeHandle"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLGetCursorName =  
reinterpret_cast<T3SQLGetCursorName>(osl_getFunctionSymbol(pODBCso, 
u"SQLGetCursorName"_ustr.pData ))) == nullptr )
-        return false;
-    if( ( pODBC3SQLNativeSql    =   
reinterpret_cast<T3SQLNativeSql>(osl_getFunctionSymbol(pODBCso, 
u"SQLNativeSql"_ustr.pData ))) == nullptr )
-        return false;
-
-    return true;
-}
-
-
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx 
b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index f8bb5a6ad0b7..1537ede5f6fe 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -147,7 +147,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute(  )
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     try
     {
-        SQLRETURN nReturn = N3SQLExecute(m_aStatementHandle);
+        SQLRETURN nReturn = functions().Execute(m_aStatementHandle);
 
         
OTools::ThrowException(m_pConnection.get(),nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
         bool needData = nReturn == SQL_NEED_DATA;
@@ -161,7 +161,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute(  )
             // Get the parameter number that requires data
 
             sal_Int32* paramIndex = nullptr;
-            N3SQLParamData(m_aStatementHandle, 
reinterpret_cast<SQLPOINTER*>(&paramIndex));
+            functions().ParamData(m_aStatementHandle, 
reinterpret_cast<SQLPOINTER*>(&paramIndex));
 
             // If the parameter index is -1, there is no
             // more data required
@@ -373,7 +373,7 @@ void OPreparedStatement::setParameter(const sal_Int32 
parameterIndex, const sal_
     rDataLen = _nDataLen;
 
     SQLRETURN nRetcode;
-    nRetcode = 
(*reinterpret_cast<T3SQLBindParameter>(m_pConnection->getOdbcFunction(ODBC3SQLFunctionId::BindParameter)))(
+    nRetcode = functions().BindParameter(
                   m_aStatementHandle,
                   // checkParameterIndex guarantees this is safe
                   static_cast<SQLUSMALLINT>(parameterIndex),
@@ -513,7 +513,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 
parameterIndex, const sal_I
                             fCType,
                             fSqlType);
 
-    SQLRETURN nReturn = N3SQLBindParameter( m_aStatementHandle,
+    SQLRETURN nReturn = functions().BindParameter( m_aStatementHandle,
                                             
static_cast<SQLUSMALLINT>(parameterIndex),
                                             SQL_PARAM_INPUT,
                                             fCType,
@@ -639,8 +639,8 @@ void SAL_CALL OPreparedStatement::clearParameters(  )
     ::osl::MutexGuard aGuard( m_aMutex );
     prepareStatement();
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    N3SQLFreeStmt (m_aStatementHandle, SQL_RESET_PARAMS);
-    N3SQLFreeStmt (m_aStatementHandle, SQL_UNBIND);
+    functions().FreeStmt (m_aStatementHandle, SQL_RESET_PARAMS);
+    functions().FreeStmt (m_aStatementHandle, SQL_UNBIND);
 }
 
 void SAL_CALL OPreparedStatement::clearBatch(  )
@@ -673,7 +673,7 @@ void OPreparedStatement::initBoundParam ()
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     // Get the number of parameters
     numParams = 0;
-    N3SQLNumParams (m_aStatementHandle,&numParams);
+    functions().NumParams (m_aStatementHandle,&numParams);
 
     // There are parameter markers, allocate the bound
     // parameter objects
@@ -772,7 +772,7 @@ void OPreparedStatement::putParamData (sal_Int32 index)
 
             // Put the data
             OSL_ENSURE( m_aStatementHandle, "OPreparedStatement::putParamData: 
StatementHandle is null!" );
-            N3SQLPutData ( m_aStatementHandle, buf.getArray(), buf.getLength() 
);
+            functions().PutData ( m_aStatementHandle, buf.getArray(), 
buf.getLength() );
 
             // decrement the number of bytes still needed
             maxBytesLeft -= haveRead;
@@ -823,7 +823,7 @@ void OPreparedStatement::setStream(
 
 
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    N3SQLBindParameter(m_aStatementHandle,
+    functions().BindParameter(m_aStatementHandle,
                        static_cast<SQLUSMALLINT>(ParameterIndex),
                        SQL_PARAM_INPUT,
                        fCType,
@@ -883,7 +883,7 @@ void OPreparedStatement::prepareStatement()
     {
         OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
         OString 
aSql(OUStringToOString(m_sSqlStatement,getOwnConnection()->getTextEncoding()));
-        SQLRETURN nReturn = N3SQLPrepare(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), 
aSql.getLength());
+        SQLRETURN nReturn = functions().Prepare(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), 
aSql.getLength());
         
OTools::ThrowException(m_pConnection.get(),nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
         m_bPrepared = true;
         initBoundParam();
diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx 
b/connectivity/source/drivers/odbc/ORealDriver.cxx
deleted file mode 100644
index 28c054b45f7c..000000000000
--- a/connectivity/source/drivers/odbc/ORealDriver.cxx
+++ /dev/null
@@ -1,291 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <odbc/ODriver.hxx>
-#include <odbc/OTools.hxx>
-#include <odbc/OFunctions.hxx>
-
-namespace connectivity::odbc
-{
-        namespace {
-
-        class ORealOdbcDriver : public ODBCDriver
-        {
-        protected:
-            virtual oslGenericFunction  getOdbcFunction(ODBC3SQLFunctionId 
_nIndex)  const override;
-            virtual SQLHANDLE   EnvironmentHandle(OUString &_rPath) override;
-        public:
-            explicit ORealOdbcDriver(const css::uno::Reference< 
css::uno::XComponentContext >& _rxContext) : ODBCDriver(_rxContext) {}
-        };
-
-        }
-
-oslGenericFunction ORealOdbcDriver::getOdbcFunction(ODBC3SQLFunctionId 
_nIndex) const
-{
-    oslGenericFunction pFunction = nullptr;
-    switch(_nIndex)
-    {
-        case ODBC3SQLFunctionId::AllocHandle:
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLAllocHandle);
-            break;
-        case ODBC3SQLFunctionId::Connect:
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLConnect);
-            break;
-        case ODBC3SQLFunctionId::DriverConnect:
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLDriverConnect);
-            break;
-        case ODBC3SQLFunctionId::BrowseConnect:
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLBrowseConnect);
-            break;
-        case ODBC3SQLFunctionId::DataSources:
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLDataSources);
-            break;
-        case ODBC3SQLFunctionId::Drivers:
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDrivers);
-            break;
-        case ODBC3SQLFunctionId::GetInfo:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetInfo);
-            break;
-        case ODBC3SQLFunctionId::GetFunctions:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetFunctions);
-            break;
-        case ODBC3SQLFunctionId::GetTypeInfo:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetTypeInfo);
-            break;
-        case ODBC3SQLFunctionId::SetConnectAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLSetConnectAttr);
-            break;
-        case ODBC3SQLFunctionId::GetConnectAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetConnectAttr);
-            break;
-        case ODBC3SQLFunctionId::SetEnvAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLSetEnvAttr);
-            break;
-        case ODBC3SQLFunctionId::GetEnvAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetEnvAttr);
-            break;
-        case ODBC3SQLFunctionId::SetStmtAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLSetStmtAttr);
-            break;
-        case ODBC3SQLFunctionId::GetStmtAttr:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetStmtAttr);
-            break;
-        case ODBC3SQLFunctionId::Prepare:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLPrepare);
-            break;
-        case ODBC3SQLFunctionId::BindParameter:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLBindParameter);
-            break;
-        case ODBC3SQLFunctionId::SetCursorName:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLSetCursorName);
-            break;
-        case ODBC3SQLFunctionId::Execute:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLExecute);
-            break;
-        case ODBC3SQLFunctionId::ExecDirect:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLExecDirect);
-            break;
-        case ODBC3SQLFunctionId::DescribeParam:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLDescribeParam);
-            break;
-        case ODBC3SQLFunctionId::NumParams:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLNumParams);
-            break;
-        case ODBC3SQLFunctionId::ParamData:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLParamData);
-            break;
-        case ODBC3SQLFunctionId::PutData:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLPutData);
-            break;
-        case ODBC3SQLFunctionId::RowCount:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLRowCount);
-            break;
-        case ODBC3SQLFunctionId::NumResultCols:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLNumResultCols);
-            break;
-        case ODBC3SQLFunctionId::DescribeCol:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLDescribeCol);
-            break;
-        case ODBC3SQLFunctionId::ColAttribute:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLColAttribute);
-            break;
-        case ODBC3SQLFunctionId::BindCol:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLBindCol);
-            break;
-        case ODBC3SQLFunctionId::Fetch:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLFetch);
-            break;
-        case ODBC3SQLFunctionId::FetchScroll:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLFetchScroll);
-            break;
-        case ODBC3SQLFunctionId::GetData:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetData);
-            break;
-        case ODBC3SQLFunctionId::SetPos:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetPos);
-            break;
-        case ODBC3SQLFunctionId::BulkOperations:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLBulkOperations);
-            break;
-        case ODBC3SQLFunctionId::MoreResults:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLMoreResults);
-            break;
-        case ODBC3SQLFunctionId::GetDiagRec:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetDiagRec);
-            break;
-        case ODBC3SQLFunctionId::ColumnPrivileges:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLColumnPrivileges);
-            break;
-        case ODBC3SQLFunctionId::Columns:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLColumns);
-            break;
-        case ODBC3SQLFunctionId::ForeignKeys:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLForeignKeys);
-            break;
-        case ODBC3SQLFunctionId::PrimaryKeys:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLPrimaryKeys);
-            break;
-        case ODBC3SQLFunctionId::ProcedureColumns:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLProcedureColumns);
-            break;
-        case ODBC3SQLFunctionId::Procedures:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLProcedures);
-            break;
-        case ODBC3SQLFunctionId::SpecialColumns:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLSpecialColumns);
-            break;
-        case ODBC3SQLFunctionId::Statistics:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLStatistics);
-            break;
-        case ODBC3SQLFunctionId::TablePrivileges:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLTablePrivileges);
-            break;
-        case ODBC3SQLFunctionId::Tables:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLTables);
-            break;
-        case ODBC3SQLFunctionId::FreeStmt:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLFreeStmt);
-            break;
-        case ODBC3SQLFunctionId::CloseCursor:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLCloseCursor);
-            break;
-        case ODBC3SQLFunctionId::Cancel:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLCancel);
-            break;
-        case ODBC3SQLFunctionId::EndTran:
-
-            pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLEndTran);
-            break;
-        case ODBC3SQLFunctionId::Disconnect:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLDisconnect);
-            break;
-        case ODBC3SQLFunctionId::FreeHandle:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLFreeHandle);
-            break;
-        case ODBC3SQLFunctionId::GetCursorName:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLGetCursorName);
-            break;
-        case ODBC3SQLFunctionId::NativeSql:
-
-            pFunction = 
reinterpret_cast<oslGenericFunction>(pODBC3SQLNativeSql);
-            break;
-        default:
-            OSL_FAIL("Function unknown!");
-    }
-    return pFunction;
-}
-
-
-// ODBC Environment (common for all Connections):
-SQLHANDLE ORealOdbcDriver::EnvironmentHandle(OUString &_rPath)
-{
-    // Is (for this instance) already an Environment made?
-    if (!m_pDriverHandle)
-    {
-        SQLHANDLE h = SQL_NULL_HANDLE;
-        // allocate Environment
-
-        // load ODBC-DLL now:
-        if (!LoadLibrary_ODBC3(_rPath) || 
N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
-            return SQL_NULL_HANDLE;
-
-        // Save in global Structure
-        m_pDriverHandle = h;
-        N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION, 
reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3), SQL_IS_UINTEGER);
-        //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) 
SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
-    }
-
-    return m_pDriverHandle;
-}
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
-connectivity_odbc_ORealOdbcDriver_get_implementation(
-    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> 
const&)
-{
-    return cppu::acquire(new connectivity::odbc::ORealOdbcDriver(context));
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx 
b/connectivity/source/drivers/odbc/OResultSet.cxx
index 7a1e81593d58..696df003254e 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -142,10 +142,10 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle 
,OStatement_Base* pStmt) :
         //       We use SQLFetchScroll unconditionally in several places
         //       the *only* difference this makes is whether ::next() uses 
SQLFetchScroll or SQLFetch
         //       so this test seems pointless
-        if ( getOdbcFunction(ODBC3SQLFunctionId::GetFunctions) )
+        if (functions().has(ODBC3SQLFunctionId::GetFunctions))
         {
             SQLUSMALLINT nSupported = 0;
-            m_bUseFetchScroll = ( 
N3SQLGetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == 
SQL_SUCCESS && nSupported == 1 );
+            m_bUseFetchScroll = ( 
functions().GetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported)
 == SQL_SUCCESS && nSupported == 1 );
         }
     }
     catch(const Exception&)
@@ -169,7 +169,7 @@ void OResultSet::construct()
 
 void OResultSet::disposing()
 {
-    N3SQLCloseCursor(m_aStatementHandle);
+    functions().CloseCursor(m_aStatementHandle);
     OPropertySetHelper::disposing();
 
     ::osl::MutexGuard aGuard(m_aMutex);
@@ -184,7 +184,7 @@ SQLRETURN OResultSet::unbind(bool _bUnbindHandle)
 {
     SQLRETURN nRet = 0;
     if ( _bUnbindHandle )
-        nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND);
+        nRet = functions().FreeStmt(m_aStatementHandle,SQL_UNBIND);
 
     if ( !m_aBindVector.empty() )
     {
@@ -808,7 +808,7 @@ void SAL_CALL OResultSet::cancel(  )
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
 
-    N3SQLCancel(m_aStatementHandle);
+    functions().Cancel(m_aStatementHandle);
 }
 
 void SAL_CALL OResultSet::clearWarnings(  )
@@ -830,7 +830,7 @@ void SAL_CALL OResultSet::insertRow(  )
     Sequence<sal_Int8> aBookmark(nMaxBookmarkLen);
     static_assert(o3tl::make_unsigned(nMaxBookmarkLen) >= sizeof(SQLLEN), 
"must be larger");
 
-    SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
+    SQLRETURN nRet = functions().BindCol(m_aStatementHandle,
                                 0,
                                 SQL_C_VARBOOKMARK,
                                 aBookmark.getArray(),
@@ -838,17 +838,17 @@ void SAL_CALL OResultSet::insertRow(  )
                                 &nRealLen
                                 );
 
-    bool bPositionByBookmark = ( nullptr != getOdbcFunction( 
ODBC3SQLFunctionId::BulkOperations ) );
+    bool bPositionByBookmark = 
functions().has(ODBC3SQLFunctionId::BulkOperations);
     if ( bPositionByBookmark )
     {
-        nRet = N3SQLBulkOperations( m_aStatementHandle, SQL_ADD );
+        nRet = functions().BulkOperations( m_aStatementHandle, SQL_ADD );
         fillNeededData( nRet );
     }
     else
     {
         if(isBeforeFirst())
             next(); // must be done
-        nRet = N3SQLSetPos( m_aStatementHandle, 1, SQL_ADD, SQL_LOCK_NO_CHANGE 
);
+        nRet = functions().SetPos( m_aStatementHandle, 1, SQL_ADD, 
SQL_LOCK_NO_CHANGE );
         fillNeededData( nRet );
     }
     aBookmark.realloc(nRealLen);
@@ -869,10 +869,10 @@ void SAL_CALL OResultSet::insertRow(  )
     {
         setStmtOption<SQLLEN*, SQL_IS_POINTER>(SQL_ATTR_FETCH_BOOKMARK_PTR, 
reinterpret_cast<SQLLEN*>(aBookmark.getArray()));
 
-        nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
+        nRet = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
     }
     else
-        nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); // 
OJ 06.03.2004
+        nRet = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); // OJ 
06.03.2004
     // sometimes we got an error but we are not interested in anymore #106047# 
OJ
     //  
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
 
@@ -905,14 +905,14 @@ void SAL_CALL OResultSet::updateRow(  )
 
     try
     {
-        bool bPositionByBookmark = ( nullptr != getOdbcFunction( 
ODBC3SQLFunctionId::BulkOperations ) );
+        bool bPositionByBookmark = 
functions().has(ODBC3SQLFunctionId::BulkOperations);
         if ( bPositionByBookmark )
         {
             getBookmark();
             assert(m_aRow[0].isBound());
             Sequence<sal_Int8> aBookmark(m_aRow[0].getSequence());
             SQLLEN nRealLen = aBookmark.getLength();
-            nRet = N3SQLBindCol(m_aStatementHandle,
+            nRet = functions().BindCol(m_aStatementHandle,
                                 0,
                                 SQL_C_VARBOOKMARK,
                                 aBookmark.getArray(),
@@ -920,7 +920,7 @@ void SAL_CALL OResultSet::updateRow(  )
                                 &nRealLen
                                 );
             
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-            nRet = N3SQLBulkOperations(m_aStatementHandle, 
SQL_UPDATE_BY_BOOKMARK);
+            nRet = functions().BulkOperations(m_aStatementHandle, 
SQL_UPDATE_BY_BOOKMARK);
             fillNeededData(nRet);
             // the driver should not have touched this
             // (neither the contents of aBookmark FWIW)
@@ -928,7 +928,7 @@ void SAL_CALL OResultSet::updateRow(  )
         }
         else
         {
-            nRet = 
N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
+            nRet = 
functions().SetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
             fillNeededData(nRet);
         }
         
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
@@ -952,7 +952,7 @@ void SAL_CALL OResultSet::deleteRow(  )
 {
     SQLRETURN nRet = SQL_SUCCESS;
     sal_Int32 nPos = getDriverPos();
-    nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
+    nRet = 
functions().SetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
     
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
 
     m_bRowDeleted = ( m_pRowStatusArray[0] == SQL_ROW_DELETED );
@@ -982,7 +982,7 @@ void SAL_CALL OResultSet::moveToInsertRow(  )
     invalidateCache();
     // first unbound all columns
     OSL_VERIFY( unbind() == SQL_SUCCESS );
-    //  SQLRETURN nRet = 
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE 
,(SQLPOINTER)1,SQL_IS_INTEGER);
+    //  SQLRETURN nRet = 
functions().SetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE 
,(SQLPOINTER)1,SQL_IS_INTEGER);
 }
 
 
@@ -1122,8 +1122,8 @@ void SAL_CALL OResultSet::refreshRow(  )
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
 
-    //  SQLRETURN nRet = 
N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
+    //  SQLRETURN nRet = 
functions().SetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
     
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
 }
 
@@ -1192,7 +1192,7 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const  Any& 
bookmark )
 
         if ( SQL_INVALID_HANDLE != nReturn && SQL_ERROR != nReturn )
         {
-            m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
+            m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
             
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
             TBookmarkPosMap::const_iterator aFind = 
m_aPosToBookmarks.find(aBookmark);
             if(aFind != m_aPosToBookmarks.end())
@@ -1216,7 +1216,7 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( 
const  Any& bookmark, sal_
     bookmark >>= aBookmark;
     setStmtOption<SQLLEN*, SQL_IS_POINTER>(SQL_ATTR_FETCH_BOOKMARK_PTR, 
reinterpret_cast<SQLLEN*>(aBookmark.getArray()));
 
-    m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows);
+    m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows);
     
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
     return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == 
SQL_SUCCESS_WITH_INFO;
 }
@@ -1270,14 +1270,14 @@ template < typename T, SQLINTEGER BufferLength > T 
OResultSet::getStmtOption (SQ
 {
     T result (0);
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    N3SQLGetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, 
nullptr);
+    functions().GetStmtAttr(m_aStatementHandle, fOption, &result, 
BufferLength, nullptr);
     return result;
 }
 template < typename T, SQLINTEGER BufferLength > SQLRETURN 
OResultSet::setStmtOption (SQLINTEGER fOption, T value) const
 {
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     SQLPOINTER sv = reinterpret_cast<SQLPOINTER>(value);
-    return N3SQLSetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
+    return functions().SetStmtAttr(m_aStatementHandle, fOption, sv, 
BufferLength);
 }
 
 sal_Int32 OResultSet::getResultSetConcurrency() const
@@ -1322,7 +1322,7 @@ OUString OResultSet::getCursorName() const
 {
     SQLCHAR pName[258];
     SQLSMALLINT nRealLen = 0;
-    N3SQLGetCursorName(m_aStatementHandle,pName,256,&nRealLen);
+    functions().GetCursorName(m_aStatementHandle,pName,256,&nRealLen);
     return OUString::createFromAscii(reinterpret_cast<char*>(pName));
 }
 
@@ -1680,9 +1680,9 @@ bool OResultSet::move(IResultSetHelper::Movement 
_eCursorPosition, sal_Int32 _nO
     // _eCursorPosition == IResultSetHelper::NEXT/PREVIOUS
     // when fetchSize > 1
     if ( !m_bUseFetchScroll && _eCursorPosition == IResultSetHelper::NEXT )
-        m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
+        m_nCurrentFetchState = functions().Fetch(m_aStatementHandle);
     else
-        m_nCurrentFetchState = 
N3SQLFetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
+        m_nCurrentFetchState = 
functions().FetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
 
     SAL_INFO(
         "connectivity.odbc",
@@ -1773,7 +1773,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
         return;
 
     void* pColumnIndex = nullptr;
-    nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+    nRet = functions().ParamData(m_aStatementHandle,&pColumnIndex);
 
     do
     {
@@ -1789,12 +1789,12 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
             case DataType::LONGVARBINARY:
             case DataType::BLOB:
                 aSeq = m_aRow[nColumnIndex].getSequence();
-                N3SQLPutData (m_aStatementHandle, aSeq.getArray(), 
aSeq.getLength());
+                functions().PutData (m_aStatementHandle, aSeq.getArray(), 
aSeq.getLength());
                 break;
             case SQL_WLONGVARCHAR:
             {
                 OUString const & sRet = m_aRow[nColumnIndex].getString();
-                N3SQLPutData (m_aStatementHandle, 
static_cast<SQLPOINTER>(const_cast<sal_Unicode *>(sRet.getStr())), 
sizeof(sal_Unicode)*sRet.getLength());
+                functions().PutData (m_aStatementHandle, 
static_cast<SQLPOINTER>(const_cast<sal_Unicode *>(sRet.getStr())), 
sizeof(sal_Unicode)*sRet.getLength());
                 break;
             }
             case DataType::LONGVARCHAR:
@@ -1802,13 +1802,13 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
             {
                 OUString sRet = m_aRow[nColumnIndex].getString();
                 OString aString(OUStringToOString(sRet,m_nTextEncoding));
-                N3SQLPutData (m_aStatementHandle, 
static_cast<SQLPOINTER>(const_cast<char *>(aString.getStr())), 
aString.getLength());
+                functions().PutData (m_aStatementHandle, 
static_cast<SQLPOINTER>(const_cast<char *>(aString.getStr())), 
aString.getLength());
                 break;
             }
             default:
                 SAL_WARN( "connectivity.odbc", "Not supported at the moment!");
         }
-        nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+        nRet = functions().ParamData(m_aStatementHandle,&pColumnIndex);
     }
     while (nRet == SQL_NEED_DATA);
 }
diff --git a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx 
b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
index f71e77d19c81..8448e7bd6ee9 100644
--- a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
@@ -38,7 +38,7 @@ OUString OResultSetMetaData::getCharColAttrib(sal_Int32 
_column,sal_Int32 ident)
     SQLSMALLINT BUFFER_LEN = 128;
     std::unique_ptr<char[]> pName(new char[BUFFER_LEN+1]);
     SQLSMALLINT nRealLen=0;
-    SQLRETURN nRet = N3SQLColAttribute(m_aStatementHandle,
+    SQLRETURN nRet = functions().ColAttribute(m_aStatementHandle,
                                     static_cast<SQLUSMALLINT>(column),
                                     static_cast<SQLUSMALLINT>(ident),
                                     static_cast<SQLPOINTER>(pName.get()),
@@ -58,7 +58,7 @@ OUString OResultSetMetaData::getCharColAttrib(sal_Int32 
_column,sal_Int32 ident)
     if(nRealLen > BUFFER_LEN)
     {
         pName.reset(new char[nRealLen+1]);
-        nRet = N3SQLColAttribute(m_aStatementHandle,
+        nRet = functions().ColAttribute(m_aStatementHandle,
                                     static_cast<SQLUSMALLINT>(column),
                                     static_cast<SQLUSMALLINT>(ident),
                                     static_cast<SQLPOINTER>(pName.get()),
@@ -81,7 +81,7 @@ SQLLEN OResultSetMetaData::getNumColAttrib(OConnection const 
* _pConnection
                                               ,sal_Int32 _ident)
 {
     SQLLEN nValue=0;
-    
OTools::ThrowException(_pConnection,(*reinterpret_cast<T3SQLColAttribute>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::ColAttribute)))(_aStatementHandle,
+    
OTools::ThrowException(_pConnection,_pConnection->functions().ColAttribute(_aStatementHandle,
                                          static_cast<SQLUSMALLINT>(_column),
                                          static_cast<SQLUSMALLINT>(_ident),
                                          nullptr,
@@ -161,7 +161,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount(  )
     if(m_nColCount != -1)
         return m_nColCount;
     sal_Int16 nNumResultCols=0;
-    
OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    
OTools::ThrowException(m_pConnection,functions().NumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
     m_nColCount = nNumResultCols;
     return m_nColCount;
 }
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx 
b/connectivity/source/drivers/odbc/OStatement.cxx
index 530634747e30..1e9086e9f2eb 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -161,7 +161,7 @@ void SAL_CALL OStatement_Base::cancel(  )
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    N3SQLCancel(m_aStatementHandle);
+    functions().Cancel(m_aStatementHandle);
 }
 
 
@@ -195,7 +195,7 @@ void OStatement_Base::reset()
     }
     if(m_aStatementHandle)
     {
-        THROW_SQL(N3SQLFreeStmt(m_aStatementHandle, SQL_CLOSE));
+        THROW_SQL(functions().FreeStmt(m_aStatementHandle, SQL_CLOSE));
     }
 }
 
@@ -227,7 +227,7 @@ SQLLEN OStatement_Base::getRowCount()
     SQLLEN numRows = 0;
 
     try {
-        THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
+        THROW_SQL(functions().RowCount(m_aStatementHandle,&numRows));
     }
     catch (const SQLException&)
     {
@@ -299,7 +299,7 @@ sal_Int32 OStatement_Base::getColumnCount()
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
 
     try {
-        THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols));
+        THROW_SQL(functions().NumResultCols(m_aStatementHandle,&numCols));
     }
     catch (const SQLException&)
     {
@@ -332,7 +332,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& 
sql )
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
 
     try {
-        THROW_SQL(N3SQLExecDirect(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), 
aSql.getLength()));
+        THROW_SQL(functions().ExecDirect(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), 
aSql.getLength()));
     }
     catch (const SQLWarning&) {
 
@@ -404,14 +404,14 @@ template < typename T, SQLINTEGER BufferLength > T 
OStatement_Base::getStmtOptio
 {
     T result (0);
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    N3SQLGetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, 
nullptr);
+    functions().GetStmtAttr(m_aStatementHandle, fOption, &result, 
BufferLength, nullptr);
     return result;
 }
 template < typename T, SQLINTEGER BufferLength > SQLRETURN 
OStatement_Base::setStmtOption (SQLINTEGER fOption, T value) const
 {
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     SQLPOINTER sv = reinterpret_cast<SQLPOINTER>(value);
-    return N3SQLSetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
+    return functions().SetStmtAttr(m_aStatementHandle, fOption, sv, 
BufferLength);
 }
 
 
@@ -481,17 +481,17 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch(  
)
 
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     auto s = aBatchSql.makeStringAndClear();
-    THROW_SQL(N3SQLExecDirect(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), 
s.getLength()));
+    THROW_SQL(functions().ExecDirect(m_aStatementHandle, 
reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), 
s.getLength()));
 
     Sequence< sal_Int32 > aRet(nLen);
     sal_Int32* pArray = aRet.getArray();
     for(sal_Int32 j=0;j<nLen;++j)
     {
-        SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle);
+        SQLRETURN nError = functions().MoreResults(m_aStatementHandle);
         if(nError == SQL_SUCCESS)
         {
             SQLLEN nRowCount=0;
-            N3SQLRowCount(m_aStatementHandle,&nRowCount);
+            functions().RowCount(m_aStatementHandle,&nRowCount);
             pArray[j] = nRowCount;
         }
     }
@@ -573,7 +573,7 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults(  )
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
 
     try {
-        hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS;
+        hasResultSet = functions().MoreResults(m_aStatementHandle) == 
SQL_SUCCESS;
     }
     catch (const SQLWarning &ex) {
 
@@ -704,7 +704,7 @@ OUString OStatement_Base::getCursorName() const
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
     SQLCHAR pName[258];
     SQLSMALLINT nRealLen = 0;
-e 
... etc. - the rest is truncated

Reply via email to