summaryrefslogtreecommitdiffstats
path: root/connectivity/source/inc/odbc
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/inc/odbc')
-rw-r--r--connectivity/source/inc/odbc/OBoundParam.hxx131
-rw-r--r--connectivity/source/inc/odbc/OConnection.hxx129
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaData.hxx207
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx263
-rw-r--r--connectivity/source/inc/odbc/ODriver.hxx87
-rw-r--r--connectivity/source/inc/odbc/OFunctions.hxx603
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx153
-rw-r--r--connectivity/source/inc/odbc/OResultSet.hxx358
-rw-r--r--connectivity/source/inc/odbc/OResultSetMetaData.hxx120
-rw-r--r--connectivity/source/inc/odbc/OStatement.hxx247
-rw-r--r--connectivity/source/inc/odbc/OTools.hxx250
-rw-r--r--connectivity/source/inc/odbc/odbcbasedllapi.hxx35
12 files changed, 2583 insertions, 0 deletions
diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
new file mode 100644
index 000000000..0616760bf
--- /dev/null
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -0,0 +1,131 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <odbc/odbcbasedllapi.hxx>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+ class OOO_DLLPUBLIC_ODBCBASE OBoundParam
+ {
+
+ public:
+ OBoundParam()
+ : binaryData(nullptr)
+ , paramLength(0)
+ , paramInputStreamLen(0)
+ {
+ }
+ ~OBoundParam()
+ {
+ free(binaryData);
+ }
+
+ // allocBindDataBuffer
+ // Allocates and returns a new bind data buffer of the specified
+ // length
+
+ void* allocBindDataBuffer (sal_Int32 bufLen)
+ {
+ // Reset the input stream and sequence, we are doing a new bind
+ setInputStream (nullptr, 0);
+ aSequence.realloc(0);
+
+ free(binaryData);
+ binaryData = (bufLen > 0) ? malloc(bufLen) : nullptr;
+
+ return binaryData;
+ }
+
+
+ // getBindLengthBuffer
+ // Returns the length buffer to be used when binding to a parameter
+
+ SQLLEN& getBindLengthBuffer ()
+ {
+ return paramLength;
+ }
+
+
+ // setInputStream
+ // Sets the input stream for the bound parameter
+
+ void setInputStream(const css::uno::Reference< css::io::XInputStream>& inputStream,
+ sal_Int32 len)
+ {
+ paramInputStream = inputStream;
+ paramInputStreamLen = len;
+ }
+
+ void setSequence(const css::uno::Sequence< sal_Int8 >& _aSequence)
+ {
+ aSequence = _aSequence;
+ }
+
+
+ // getInputStream
+ // Gets the input stream for the bound parameter
+
+ const css::uno::Reference< css::io::XInputStream>& getInputStream () const
+ {
+ return paramInputStream;
+ }
+
+
+ // getInputStreamLen
+ // Gets the input stream length for the bound parameter
+
+ sal_Int32 getInputStreamLen () const
+ {
+ return paramInputStreamLen;
+ }
+
+
+ private:
+
+ // Data attributes
+
+
+ void *binaryData; // Storage area to be used
+ // when binding the parameter
+
+ SQLLEN paramLength; // Storage area to be used
+ // for the bound length of the
+ // parameter. Note that this
+ // data is in native format.
+
+ css::uno::Reference< css::io::XInputStream> paramInputStream;
+ css::uno::Sequence< sal_Int8 > aSequence;
+ // When an input stream is
+ // bound to a parameter, a
+ // reference to the input stream is saved
+ // until not needed anymore.
+
+ sal_Int32 paramInputStreamLen; // Length of input stream
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx
new file mode 100644
index 000000000..cb05d7373
--- /dev/null
+++ b/connectivity/source/inc/odbc/OConnection.hxx
@@ -0,0 +1,129 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
+
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <connectivity/odbc.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <TConnection.hxx>
+#include <OTypeInfo.hxx>
+#include <odbc/OTools.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <AutoRetrievingBase.hxx>
+#include <osl/module.h>
+
+
+#include <map>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+ class ODBCDriver;
+
+ typedef connectivity::OMetaConnection OConnection_BASE;
+ typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
+
+ class OOO_DLLPUBLIC_ODBCBASE OConnection final :
+ public OConnection_BASE,
+ public OAutoRetrievingBase
+ {
+ // Data attributes
+
+ std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements
+
+
+ OUString m_sUser; // the user name
+ rtl::Reference<ODBCDriver>
+ m_xDriver; // Pointer to the owning
+ // driver object
+
+ SQLHANDLE m_aConnectionHandle;
+ SQLHANDLE m_pDriverHandleCopy; // performance reason
+ sal_Int32 m_nStatementCount;
+ bool m_bClosed;
+ bool m_bUseCatalog; // should we use the catalog on filebased databases
+ bool m_bUseOldDateFormat;
+ bool m_bIgnoreDriverPrivileges;
+ bool m_bPreventGetVersionColumns; // #i60273#
+ bool m_bReadOnly;
+
+
+ SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent);
+
+ public:
+ oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const;
+ /// @throws css::sdbc::SQLException
+ SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info);
+
+ OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver);
+ // OConnection(const SQLHANDLE _pConnectionHandle);
+ virtual ~OConnection() override;
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ // XConnection
+ virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override;
+ virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override;
+ virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override;
+ virtual sal_Bool SAL_CALL getAutoCommit( ) override;
+ virtual void SAL_CALL commit( ) override;
+ virtual void SAL_CALL rollback( ) override;
+ virtual sal_Bool SAL_CALL isClosed( ) override;
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
+ virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override;
+ virtual sal_Bool SAL_CALL isReadOnly( ) override;
+ virtual void SAL_CALL setCatalog( const OUString& catalog ) override;
+ virtual OUString SAL_CALL getCatalog( ) override;
+ virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override;
+ virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override;
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override;
+ virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings( ) override;
+ virtual void SAL_CALL clearWarnings( ) override;
+
+ SQLHANDLE getConnection() { return m_aConnectionHandle; }
+
+ // should we use the catalog on filebased databases
+ bool isCatalogUsed() const { return m_bUseCatalog; }
+ bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; }
+ bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; }
+ bool useOldDateFormat() const { return m_bUseOldDateFormat; }
+ ODBCDriver* getDriver() const { return m_xDriver.get();}
+
+ SQLHANDLE createStatementHandle();
+ // close and free the handle and set it to SQL_NULLHANDLE
+ void freeStatementHandle(SQLHANDLE& _pHandle);
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
new file mode 100644
index 000000000..c4ad2c075
--- /dev/null
+++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
@@ -0,0 +1,207 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
+
+#include <odbc/OConnection.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <TDatabaseMetaDataBase.hxx>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+
+ //************ Class: ODatabaseMetaData
+
+
+ class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaData final :
+ public ODatabaseMetaDataBase
+ {
+ SQLHANDLE m_aConnectionHandle;
+ OConnection* m_pConnection;
+ bool m_bUseCatalog;
+
+ // cached database information
+ virtual OUString impl_getIdentifierQuoteString_throw( ) override;
+ virtual bool impl_isCatalogAtStart_throw( ) override;
+ virtual OUString impl_getCatalogSeparator_throw( ) override;
+ virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override;
+ virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ;
+ virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override;
+ virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ;
+ virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ;
+ virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override;
+ virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override;
+ virtual sal_Int32 impl_getMaxStatements_throw( ) override;
+ virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override;
+ virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override;
+ OUString getURLImpl();
+ virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override;
+ virtual ~ODatabaseMetaData() override;
+
+ public:
+ ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon);
+
+ // XDatabaseMetaData
+ virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override;
+ virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override;
+ virtual OUString SAL_CALL getURL( ) override;
+ virtual OUString SAL_CALL getUserName( ) override;
+ virtual sal_Bool SAL_CALL isReadOnly( ) override;
+ virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override;
+ virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override;
+ virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override;
+ virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override;
+ virtual OUString SAL_CALL getDatabaseProductName( ) override;
+ virtual OUString SAL_CALL getDatabaseProductVersion( ) override;
+ virtual OUString SAL_CALL getDriverName( ) override;
+ virtual OUString SAL_CALL getDriverVersion( ) override;
+ virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override;
+ virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override;
+ virtual sal_Bool SAL_CALL usesLocalFiles( ) override;
+ virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override;
+ virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override;
+ virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override;
+ virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override;
+ virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override;
+
+ virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override;
+ virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override;
+
+ virtual OUString SAL_CALL getSQLKeywords( ) override;
+ virtual OUString SAL_CALL getNumericFunctions( ) override;
+ virtual OUString SAL_CALL getStringFunctions( ) override;
+ virtual OUString SAL_CALL getSystemFunctions( ) override;
+ virtual OUString SAL_CALL getTimeDateFunctions( ) override;
+ virtual OUString SAL_CALL getSearchStringEscape( ) override;
+ virtual OUString SAL_CALL getExtraNameCharacters( ) override;
+ virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override;
+ virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override;
+ virtual sal_Bool SAL_CALL supportsTypeConversion( ) override;
+ virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override;
+ virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override;
+ virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override;
+ virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override;
+ virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override;
+ virtual sal_Bool SAL_CALL supportsGroupBy( ) override;
+ virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override;
+ virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override;
+ virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override;
+ virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override;
+ virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override;
+ virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override;
+ virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override;
+ virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override;
+ virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override;
+ virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override;
+ virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override;
+ virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override;
+ virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override;
+ virtual sal_Bool SAL_CALL supportsOuterJoins( ) override;
+ virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override;
+ virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override;
+ virtual OUString SAL_CALL getSchemaTerm( ) override;
+ virtual OUString SAL_CALL getProcedureTerm( ) override;
+ virtual OUString SAL_CALL getCatalogTerm( ) override;
+
+ virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override;
+ virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override;
+ virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override;
+ virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override;
+
+ virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override;
+ virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override;
+ virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override;
+ virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override;
+ virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override;
+ virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override;
+ virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override;
+ virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override;
+ virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override;
+ virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override;
+ virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override;
+ virtual sal_Bool SAL_CALL supportsUnion( ) override;
+ virtual sal_Bool SAL_CALL supportsUnionAll( ) override;
+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override;
+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override;
+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override;
+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override;
+ virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override;
+ virtual sal_Int32 SAL_CALL getMaxConnections( ) override;
+ virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxRowSize( ) override;
+ virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override;
+ virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override;
+ virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override;
+ virtual sal_Bool SAL_CALL supportsTransactions( ) override;
+ virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override;
+ virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override;
+ virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override;
+ virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override;
+ virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override;
+ virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override;
+ virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override;
+ virtual sal_Bool SAL_CALL supportsBatchUpdates( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getUDTs( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const css::uno::Sequence< sal_Int32 >& types ) override;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
new file mode 100644
index 000000000..64d548a76
--- /dev/null
+++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
@@ -0,0 +1,263 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
+
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <odbc/OStatement.hxx>
+#include <odbc/ODatabaseMetaData.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <memory>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+ /*
+ ** java_sql_ResultSet
+ */
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
+ css::sdbc::XRow,
+ css::sdbc::XResultSetMetaDataSupplier,
+ css::util::XCancellable,
+ css::sdbc::XWarningsSupplier,
+ css::sdbc::XCloseable,
+ css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
+
+ class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaDataResultSet :
+ public cppu::BaseMutex,
+ public ODatabaseMetaDataResultSet_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
+ {
+ std::vector< sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time
+
+ std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> >
+ m_aValueRange;
+
+ std::map<sal_Int32,SWORD> m_aODBCColumnTypes;
+
+ SQLHANDLE m_aStatementHandle; // ... until freed
+ css::uno::WeakReferenceHelper m_aStatement;
+ css::uno::Reference< css::sdbc::XResultSetMetaData>
+ m_xMetaData;
+ std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray;
+ rtl::Reference<OConnection> m_pConnection;
+ rtl_TextEncoding m_nTextEncoding;
+ sal_Int32 m_nRowPos;
+ sal_Int32 m_nDriverColumnCount; // column count of the driver which can sometimes be less than the metadata count
+ SQLRETURN m_nCurrentFetchState;
+ bool m_bWasNull;
+ bool m_bEOF; // after last record
+
+ // set the columncount of the driver
+ void checkColumnCount();
+ static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; }
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static sal_Int32 getFetchSize();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static OUString getCursorName();
+ SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex);
+
+ sal_Int32 mapColumn (sal_Int32 column);
+
+ protected:
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
+ virtual ~ODatabaseMetaDataResultSet() override;
+ template < typename T, SQLSMALLINT sqlTypeId > T getInteger ( sal_Int32 columnIndex );
+
+ public:
+ // A ctor needed for returning the object
+ ODatabaseMetaDataResultSet(OConnection* _pConnection);
+
+
+ oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
+ {
+ return m_pConnection->getOdbcFunction(_nIndex);
+ }
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() throw() override;
+ virtual void SAL_CALL release() throw() override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ css::uno::Reference< css::uno::XInterface > operator *()
+ {
+ return css::uno::Reference< css::uno::XInterface >(*static_cast<ODatabaseMetaDataResultSet_BASE*>(this));
+ }
+ // XResultSet
+ virtual sal_Bool SAL_CALL next( ) override;
+ virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
+ virtual sal_Bool SAL_CALL isAfterLast( ) override;
+ virtual sal_Bool SAL_CALL isFirst( ) override;
+ virtual sal_Bool SAL_CALL isLast( ) override;
+ virtual void SAL_CALL beforeFirst( ) override;
+ virtual void SAL_CALL afterLast( ) override;
+ virtual sal_Bool SAL_CALL first( ) override;
+ virtual sal_Bool SAL_CALL last( ) override;
+ virtual sal_Int32 SAL_CALL getRow( ) override;
+ virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
+ virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
+ virtual sal_Bool SAL_CALL previous( ) override;
+ virtual void SAL_CALL refreshRow( ) override;
+ virtual sal_Bool SAL_CALL rowUpdated( ) override;
+ virtual sal_Bool SAL_CALL rowInserted( ) override;
+ virtual sal_Bool SAL_CALL rowDeleted( ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
+ // XRow
+ virtual sal_Bool SAL_CALL wasNull( ) override;
+ virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
+ // XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
+ // XCancellable
+ virtual void SAL_CALL cancel( ) override;
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings( ) override;
+ virtual void SAL_CALL clearWarnings( ) override;
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openTablesTypes( );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openTypeInfo();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openCatalogs();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openSchemas();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openTables(const css::uno::Any& catalog, const OUString& schemaPattern,
+ const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openColumnPrivileges( const css::uno::Any& catalog, const OUString& schema,
+ const OUString& table, const OUString& columnNamePattern );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern,
+ const OUString& tableNamePattern, const OUString& columnNamePattern );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern,
+ const OUString& procedureNamePattern,const OUString& columnNamePattern );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern,
+ const OUString& procedureNamePattern);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openVersionColumns(const css::uno::Any& catalog, const OUString& schema,
+ const OUString& table);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema,
+ const OUString& table,sal_Int32 scope, bool nullable );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openForeignKeys( const css::uno::Any& catalog, const OUString* schema,const OUString* table,
+ const css::uno::Any& catalog2, const OUString* schema2,const OUString* table2);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openExportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openImportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern,
+ const OUString& tableNamePattern);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema,
+ const OUString& table,sal_Int32 scope, bool nullable );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void openIndexInfo( const css::uno::Any& catalog, const OUString& schema,
+ const OUString& table,bool unique,bool approximate );
+
+ protected:
+ using OPropertySetHelper::getFastPropertyValue;
+ };
+ }
+
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx
new file mode 100644
index 000000000..6172cd01a
--- /dev/null
+++ b/connectivity/source/inc/odbc/ODriver.hxx
@@ -0,0 +1,87 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
+
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <connectivity/odbc.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <osl/module.h>
+#include <odbc/OTools.hxx>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo > ODriver_BASE;
+
+ class OOO_DLLPUBLIC_ODBCBASE SAL_NO_VTABLE ODBCDriver : public ODriver_BASE
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+
+ connectivity::OWeakRefArray m_xConnections; // vector containing a list
+ // of all the Connection objects
+ // for this Driver
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xORB;
+ SQLHANDLE m_pDriverHandle;
+
+ virtual SQLHANDLE EnvironmentHandle(OUString &_rPath) = 0;
+
+ public:
+
+ ODBCDriver(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory);
+
+ // only possibility to get the odbc functions
+ virtual oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const = 0;
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XInterface
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ // XDriver
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
+ virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ virtual sal_Int32 SAL_CALL getMajorVersion( ) override;
+ virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
+
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& getORB() const { return m_xORB; }
+ };
+ }
+
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OFunctions.hxx b/connectivity/source/inc/odbc/OFunctions.hxx
new file mode 100644
index 000000000..95787a1db
--- /dev/null
+++ b/connectivity/source/inc/odbc/OFunctions.hxx
@@ -0,0 +1,603 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
+
+#include <connectivity/odbc.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/module.h>
+
+namespace connectivity
+{
+
+// sal_Bool LoadFunctions(oslModule pODBCso, sal_Bool _bDS=sal_True);
+bool LoadLibrary_ODBC3(OUString &_rPath);
+// sal_Bool LoadLibrary_ADABAS(OUString &_rPath);
+
+ // Connecting to a data source
+ typedef SQLRETURN (SQL_API *T3SQLAllocHandle) (SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandlePtr);
+
+ #define N3SQLAllocHandle(a,b,c) (*reinterpret_cast<T3SQLAllocHandle>(getOdbcFunction(ODBC3SQLFunctionId::AllocHandle)))(a,b,c)
+
+ typedef SQLRETURN (SQL_API *T3SQLConnect) (SQLHDBC ConnectionHandle,SQLCHAR *ServerName,SQLSMALLINT NameLength1,SQLCHAR *UserName,SQLSMALLINT NameLength2,SQLCHAR *Authentication,SQLSMALLINT NameLength3);
+
+ #define N3SQLConnect(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLConnect>(getOdbcFunction(ODBC3SQLFunctionId::Connect)))(a,b,c,d,e,f,g)
+
+ typedef SQLRETURN (SQL_API *T3SQLDriverConnect) ( SQLHDBC ConnectionHandle,
+ HWND WindowHandle,
+ SQLCHAR * InConnectionString,
+ SQLSMALLINT StringLength1,
+ SQLCHAR * OutConnectionString,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLength2Ptr,
+ SQLUSMALLINT DriverCompletion);
+
+ #define N3SQLDriverConnect(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDriverConnect>(getOdbcFunction(ODBC3SQLFunctionId::DriverConnect)))(a,b,c,d,e,f,g,h)
+
+ typedef SQLRETURN (SQL_API *T3SQLBrowseConnect) ( SQLHDBC ConnectionHandle,
+ SQLCHAR * InConnectionString,
+ SQLSMALLINT StringLength1,
+ SQLCHAR * OutConnectionString,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLength2Ptr);
+
+ #define N3SQLBrowseConnect(a,b,c,d,e,f) (*reinterpret_cast<T3SQLBrowseConnect>(getOdbcFunction(ODBC3SQLFunctionId::BrowseConnect)))(a,b,c,d,e,f)
+
+ // Obtaining information about a driver and data source
+ typedef SQLRETURN (SQL_API *T3SQLDataSources) ( SQLHENV EnvironmentHandle,
+ SQLUSMALLINT Direction,
+ SQLCHAR * ServerName,
+ SQLSMALLINT BufferLength1,
+ SQLSMALLINT * NameLength1Ptr,
+ SQLCHAR * Description,
+ SQLSMALLINT BufferLength2,
+ SQLSMALLINT * NameLength2Ptr);
+
+ #define N3SQLDataSources(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDataSources>(getOdbcFunction(ODBC3SQLFunctionId::DataSources)))(a,b,c,d,e,f,g,h)
+
+ typedef SQLRETURN (SQL_API *T3SQLDrivers) ( SQLHENV EnvironmentHandle,
+ SQLUSMALLINT Direction,
+ SQLCHAR * DriverDescription,
+ SQLSMALLINT BufferLength1,
+ SQLSMALLINT * DescriptionLengthPtr,
+ SQLCHAR * DriverAttributes,
+ SQLSMALLINT BufferLength2,
+ SQLSMALLINT * AttributesLengthPtr);
+
+ #define N3SQLDrivers(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDrivers>(getOdbcFunction(ODBC3SQLFunctionId::Drivers)))(a,b,c,d,e,f,g,h)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetInfo) ( SQLHDBC ConnectionHandle,
+ SQLUSMALLINT InfoType,
+ SQLPOINTER InfoValuePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLengthPtr);
+
+ #define N3SQLGetInfo(a,b,c,d,e) (*reinterpret_cast<T3SQLGetInfo>(getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(a,b,c,d,e)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetFunctions) (SQLHDBC ConnectionHandle,
+ SQLUSMALLINT FunctionId,
+ SQLUSMALLINT * SupportedPtr);
+
+ #define N3SQLGetFunctions(a,b,c) (*reinterpret_cast<T3SQLGetFunctions>(getOdbcFunction(ODBC3SQLFunctionId::GetFunctions)))(a,b,c)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetTypeInfo) ( SQLHSTMT StatementHandle,
+ SQLSMALLINT DataType);
+
+ #define N3SQLGetTypeInfo(a,b) (*reinterpret_cast<T3SQLGetTypeInfo>(getOdbcFunction(ODBC3SQLFunctionId::GetTypeInfo)))(a,b)
+
+ // Setting and retrieving driver attributes
+ typedef SQLRETURN (SQL_API *T3SQLSetConnectAttr)(SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength);
+
+ #define N3SQLSetConnectAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetConnectAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetConnectAttr)))(a,b,c,d)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetConnectAttr) (SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength);
+
+ #define N3SQLGetConnectAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetConnectAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetConnectAttr)))(a,b,c,d,e)
+
+
+ typedef SQLRETURN (SQL_API *T3SQLSetEnvAttr) ( SQLHENV EnvironmentHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength);
+
+ #define N3SQLSetEnvAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetEnvAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetEnvAttr)))(a,b,c,d)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetEnvAttr) ( SQLHENV EnvironmentHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength);
+
+ #define N3SQLGetEnvAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetEnvAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetEnvAttr)))(a,b,c,d,e)
+
+
+ typedef SQLRETURN (SQL_API *T3SQLSetStmtAttr) ( SQLHSTMT StatementHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength);
+
+ #define N3SQLSetStmtAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetStmtAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetStmtAttr)))(a,b,c,d)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetStmtAttr) ( SQLHSTMT StatementHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength);
+
+ #define N3SQLGetStmtAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetStmtAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetStmtAttr)))(a,b,c,d,e)
+
+ // Setting and retrieving descriptor fields
+ /*typedef SQLRETURN (SQL_API *T3SQLSetDescField) (SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT FieldIdentifier,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength);
+
+ #define N3SQLSetDescField(a,b,c,d,e) (*reinterpret_cast<T3SQLSetDescField>(getOdbcFunction(ODBC3SQLFunctionId::SetDescField)))(a,b,c,d,e)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetDescField) ( SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT FieldIdentifier,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER * StringLengthPtr);
+
+ #define N3SQLGetDescField(a,b,c,d,e,f) (*reinterpret_cast<T3SQLGetDescField>(getOdbcFunction(ODBC3SQLFunctionId::GetDescField)))(a,b,c,d,e,f)
+
+
+ typedef SQLRETURN (SQL_API *T3SQLGetDescRec) ( SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLCHAR * Name,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLengthPtr,
+ SQLSMALLINT * TypePtr,
+ SQLSMALLINT * SubTypePtr,
+ SQLLEN * LengthPtr,
+ SQLSMALLINT * PrecisionPtr,
+ SQLSMALLINT * ScalePtr,
+ SQLSMALLINT * NullablePtr);
+
+ #define N3SQLGetDescRec(a,b,c,d,e,f,g,h,i,j,k) (*reinterpret_cast<T3SQLGetDescRec>(getOdbcFunction(ODBC3SQLFunctionId::GetDescRec)))(a,b,c,d,e,f,g,h,i,j,k)
+
+
+ typedef SQLRETURN (SQL_API *T3SQLSetDescRec) ( SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT Type,
+ SQLSMALLINT SubType,
+ SQLLEN Length,
+ SQLSMALLINT Precision,
+ SQLSMALLINT Scale,
+ SQLPOINTER DataPtr,
+ SQLLEN * StringLengthPtr,
+ SQLLEN * IndicatorPtr);
+
+ #define N3SQLSetDescRec(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLSetDescRec>(getOdbcFunction(ODBC3SQLFunctionId::SetDescRec)))(a,b,c,d,e,f,g,h,i,j)
+ */
+
+ // Preparing SQL requests
+ typedef SQLRETURN (SQL_API *T3SQLPrepare) ( SQLHSTMT StatementHandle,
+ SQLCHAR * StatementText,
+ SQLINTEGER TextLength);
+
+ #define N3SQLPrepare(a,b,c) (*reinterpret_cast<T3SQLPrepare>(getOdbcFunction(ODBC3SQLFunctionId::Prepare)))(a,b,c)
+
+ typedef SQLRETURN (SQL_API *T3SQLBindParameter) (SQLHSTMT StatementHandle,
+ SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT InputOutputType,
+ SQLSMALLINT ValueType,
+ SQLSMALLINT ParameterType,
+ SQLULEN ColumnSize,
+ SQLSMALLINT DecimalDigits,
+ SQLPOINTER ParameterValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN * StrLen_or_IndPtr);
+
+ #define N3SQLBindParameter(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLBindParameter>(getOdbcFunction(ODBC3SQLFunctionId::BindParameter)))(a,b,c,d,e,f,g,h,i,j)
+
+ /*typedef SQLRETURN (SQL_API *T3SQLGetCursorName) (SQLHSTMT StatementHandle,
+ SQLCHAR * CursorName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * NameLengthPtr);
+
+ #define N3SQLGetCursorName(a,b,c,d) (*reinterpret_cast<T3SQLGetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::GetCursorName)))(a,b,c,d)
+ */
+
+ typedef SQLRETURN (SQL_API *T3SQLSetCursorName) (SQLHSTMT StatementHandle,
+ SQLCHAR * CursorName,
+ SQLSMALLINT NameLength);
+
+ #define N3SQLSetCursorName(a,b,c) (*reinterpret_cast<T3SQLSetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::SetCursorName)))(a,b,c)
+
+ // Submitting requests
+ typedef SQLRETURN (SQL_API *T3SQLExecute) ( SQLHSTMT StatementHandle);
+
+ #define N3SQLExecute(a) (*reinterpret_cast<T3SQLExecute>(getOdbcFunction(ODBC3SQLFunctionId::Execute)))(a)
+
+ typedef SQLRETURN (SQL_API *T3SQLExecDirect) ( SQLHSTMT StatementHandle,
+ SQLCHAR * StatementText,
+ SQLINTEGER TextLength);
+
+ #define N3SQLExecDirect(a,b,c) (*reinterpret_cast<T3SQLExecDirect>(getOdbcFunction(ODBC3SQLFunctionId::ExecDirect)))(a,b,c)
+
+ typedef SQLRETURN (SQL_API *T3SQLDescribeParam) (SQLHSTMT StatementHandle,
+ SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT * DataTypePtr,
+ SQLULEN * ParameterSizePtr,
+ SQLSMALLINT * DecimalDigitsPtr,
+ SQLSMALLINT * NullablePtr);
+
+ #define N3SQLDescribeParam(a,b,c,d,e,f) (*reinterpret_cast<T3SQLDescribeParam>(getOdbcFunction(ODBC3SQLFunctionId::DescribeParam)))(a,b,c,d,e,f)
+
+ typedef SQLRETURN (SQL_API *T3SQLNumParams) ( SQLHSTMT StatementHandle,
+ SQLSMALLINT * ParameterCountPtr);
+
+ #define N3SQLNumParams(a,b) (*reinterpret_cast<T3SQLNumParams>(getOdbcFunction(ODBC3SQLFunctionId::NumParams)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLParamData) ( SQLHSTMT StatementHandle,
+ SQLPOINTER * ValuePtrPtr);
+
+ #define N3SQLParamData(a,b) (*reinterpret_cast<T3SQLParamData>(getOdbcFunction(ODBC3SQLFunctionId::ParamData)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLPutData) ( SQLHSTMT StatementHandle,
+ SQLPOINTER DataPtr,
+ SQLLEN StrLen_or_Ind);
+
+ #define N3SQLPutData(a,b,c) (*reinterpret_cast<T3SQLPutData>(getOdbcFunction(ODBC3SQLFunctionId::PutData)))(a,b,c)
+
+ // Retrieving results and information about results
+ typedef SQLRETURN (SQL_API *T3SQLRowCount) ( SQLHSTMT StatementHandle,
+ SQLLEN * RowCountPtr);
+
+ #define N3SQLRowCount(a,b) (*reinterpret_cast<T3SQLRowCount>(getOdbcFunction(ODBC3SQLFunctionId::RowCount)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLNumResultCols) (SQLHSTMT StatementHandle,
+ SQLSMALLINT * ColumnCountPtr);
+
+ #define N3SQLNumResultCols(a,b) (*reinterpret_cast<T3SQLNumResultCols>(getOdbcFunction(ODBC3SQLFunctionId::NumResultCols)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLDescribeCol) ( SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLCHAR * ColumnName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * NameLengthPtr,
+ SQLSMALLINT * DataTypePtr,
+ SQLULEN * ColumnSizePtr,
+ SQLSMALLINT * DecimalDigitsPtr,
+ SQLSMALLINT * NullablePtr);
+
+ #define N3SQLDescribeCol(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLDescribeCol>(getOdbcFunction(ODBC3SQLFunctionId::DescribeCol)))(a,b,c,d,e,f,g,h,i)
+
+ typedef SQLRETURN (SQL_API *T3SQLColAttribute) (SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLUSMALLINT FieldIdentifier,
+ SQLPOINTER CharacterAttributePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLengthPtr,
+ SQLLEN * NumericAttributePtr);
+
+ #define N3SQLColAttribute(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLColAttribute>(getOdbcFunction(ODBC3SQLFunctionId::ColAttribute)))(a,b,c,d,e,f,g)
+
+ typedef SQLRETURN (SQL_API *T3SQLBindCol) ( SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN * StrLen_or_IndPtr);
+
+ #define N3SQLBindCol(a,b,c,d,e,f) (*reinterpret_cast<T3SQLBindCol>(getOdbcFunction(ODBC3SQLFunctionId::BindCol)))(a,b,c,d,e,f)
+
+ typedef SQLRETURN (SQL_API *T3SQLFetch) ( SQLHSTMT StatementHandle);
+
+ #define N3SQLFetch(a) (*reinterpret_cast<T3SQLFetch>(getOdbcFunction(ODBC3SQLFunctionId::Fetch)))(a)
+
+ typedef SQLRETURN (SQL_API *T3SQLFetchScroll) ( SQLHSTMT StatementHandle,
+ SQLSMALLINT FetchOrientation,
+ SQLLEN FetchOffset);
+
+ #define N3SQLFetchScroll(a,b,c) (*reinterpret_cast<T3SQLFetchScroll>(getOdbcFunction(ODBC3SQLFunctionId::FetchScroll)))(a,b,c)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetData) ( SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN * StrLen_or_IndPtr);
+
+ #define N3SQLGetData(a,b,c,d,e,f) (*reinterpret_cast<T3SQLGetData>(getOdbcFunction(ODBC3SQLFunctionId::GetData)))(a,b,c,d,e,f)
+
+ typedef SQLRETURN (SQL_API *T3SQLSetPos) ( SQLHSTMT StatementHandle,
+ SQLSETPOSIROW RowNumber,
+ SQLUSMALLINT Operation,
+ SQLUSMALLINT LockType);
+
+ #define N3SQLSetPos(a,b,c,d) (*reinterpret_cast<T3SQLSetPos>(getOdbcFunction(ODBC3SQLFunctionId::SetPos)))(a,b,c,d)
+
+ typedef SQLRETURN (SQL_API *T3SQLBulkOperations) ( SQLHSTMT StatementHandle,
+ SQLSMALLINT Operation);
+
+ #define N3SQLBulkOperations(a,b) (*reinterpret_cast<T3SQLBulkOperations>(getOdbcFunction(ODBC3SQLFunctionId::BulkOperations)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLMoreResults) ( SQLHSTMT StatementHandle);
+
+ #define N3SQLMoreResults(a) (*reinterpret_cast<T3SQLMoreResults>(getOdbcFunction(ODBC3SQLFunctionId::MoreResults)))(a)
+
+ /*typedef SQLRETURN (SQL_API *T3SQLGetDiagField) (SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT DiagIdentifier,
+ SQLPOINTER DiagInfoPtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * StringLengthPtr);
+
+ #define N3SQLGetDiagField(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLGetDiagField>(getOdbcFunction(ODBC3SQLFunctionId::GetDiagField)))(a,b,c,d,e,f,g)*/
+
+ typedef SQLRETURN (SQL_API *T3SQLGetDiagRec) ( SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT RecNumber,
+ SQLCHAR * Sqlstate,
+ SQLINTEGER * NativeErrorPtr,
+ SQLCHAR * MessageText,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT * TextLengthPtr);
+
+
+ #define N3SQLGetDiagRec(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLGetDiagRec>(getOdbcFunction(ODBC3SQLFunctionId::GetDiagRec)))(a,b,c,d,e,f,g,h)
+
+ // Obtaining information about the data source's system tables (catalog functions)
+ typedef SQLRETURN (SQL_API *T3SQLColumnPrivileges) (SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR * ColumnName,
+ SQLSMALLINT NameLength4);
+
+ #define N3SQLColumnPrivileges(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLColumnPrivileges>(getOdbcFunction(ODBC3SQLFunctionId::ColumnPrivileges)))(a,b,c,d,e,f,g,h,i)
+
+ typedef SQLRETURN (SQL_API *T3SQLColumns) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR * ColumnName,
+ SQLSMALLINT NameLength4);
+
+ #define N3SQLColumns(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLColumns>(getOdbcFunction(ODBC3SQLFunctionId::Columns)))(a,b,c,d,e,f,g,h,i)
+
+ typedef SQLRETURN (SQL_API *T3SQLForeignKeys) ( 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);
+
+ #define N3SQLForeignKeys(a,b,c,d,e,f,g,h,i,j,k,l,m) (*reinterpret_cast<T3SQLForeignKeys>(getOdbcFunction(ODBC3SQLFunctionId::ForeignKeys)))(a,b,c,d,e,f,g,h,i,j,k,l,m)
+
+ typedef SQLRETURN (SQL_API *T3SQLPrimaryKeys) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3);
+
+ #define N3SQLPrimaryKeys(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLPrimaryKeys>(getOdbcFunction(ODBC3SQLFunctionId::PrimaryKeys)))(a,b,c,d,e,f,g)
+
+ typedef SQLRETURN (SQL_API *T3SQLProcedureColumns) (SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * ProcName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR * ColumnName,
+ SQLSMALLINT NameLength4);
+
+ #define N3SQLProcedureColumns(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLProcedureColumns>(getOdbcFunction(ODBC3SQLFunctionId::ProcedureColumns)))(a,b,c,d,e,f,g,h,i)
+
+ typedef SQLRETURN (SQL_API *T3SQLProcedures) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * ProcName,
+ SQLSMALLINT NameLength3);
+
+ #define N3SQLProcedures(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLProcedures>(getOdbcFunction(ODBC3SQLFunctionId::Procedures)))(a,b,c,d,e,f,g)
+
+ typedef SQLRETURN (SQL_API *T3SQLSpecialColumns) (SQLHSTMT StatementHandle,
+ SQLUSMALLINT IdentifierType,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Scope,
+ SQLUSMALLINT Nullable);
+
+ #define N3SQLSpecialColumns(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLSpecialColumns>(getOdbcFunction(ODBC3SQLFunctionId::SpecialColumns)))(a,b,c,d,e,f,g,h,i,j)
+
+ typedef SQLRETURN (SQL_API *T3SQLStatistics) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Unique,
+ SQLUSMALLINT Reserved);
+
+ #define N3SQLStatistics(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLStatistics>(getOdbcFunction(ODBC3SQLFunctionId::Statistics)))(a,b,c,d,e,f,g,h,i)
+
+ typedef SQLRETURN (SQL_API *T3SQLTablePrivileges) (SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3);
+
+ #define N3SQLTablePrivileges(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLTablePrivileges>(getOdbcFunction(ODBC3SQLFunctionId::TablePrivileges)))(a,b,c,d,e,f,g)
+
+ typedef SQLRETURN (SQL_API *T3SQLTables) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR * SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR * TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR * TableType,
+ SQLSMALLINT NameLength4);
+
+ #define N3SQLTables(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLTables>(getOdbcFunction(ODBC3SQLFunctionId::Tables)))(a,b,c,d,e,f,g,h,i)
+
+ // Terminating a statement
+ typedef SQLRETURN (SQL_API *T3SQLFreeStmt) ( SQLHSTMT StatementHandle,
+ SQLUSMALLINT Option);
+
+ #define N3SQLFreeStmt(a,b) (*reinterpret_cast<T3SQLFreeStmt>(getOdbcFunction(ODBC3SQLFunctionId::FreeStmt)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLCloseCursor) (SQLHSTMT StatementHandle);
+
+ #define N3SQLCloseCursor(a) (*reinterpret_cast<T3SQLCloseCursor>(getOdbcFunction(ODBC3SQLFunctionId::CloseCursor)))(a)
+
+ typedef SQLRETURN (SQL_API *T3SQLCancel) ( SQLHSTMT StatementHandle);
+
+ #define N3SQLCancel(a) (*reinterpret_cast<T3SQLCancel>(getOdbcFunction(ODBC3SQLFunctionId::Cancel)))(a)
+
+ typedef SQLRETURN (SQL_API *T3SQLEndTran) ( SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT CompletionType);
+
+ #define N3SQLEndTran(a,b,c) (*reinterpret_cast<T3SQLEndTran>(getOdbcFunction(ODBC3SQLFunctionId::EndTran)))(a,b,c)
+
+ // Terminating a connection
+ typedef SQLRETURN (SQL_API *T3SQLDisconnect) (SQLHDBC ConnectionHandle);
+
+ #define N3SQLDisconnect(a) (*reinterpret_cast<T3SQLDisconnect>(getOdbcFunction(ODBC3SQLFunctionId::Disconnect)))(a)
+
+ typedef SQLRETURN (SQL_API *T3SQLFreeHandle) (SQLSMALLINT HandleType,
+ SQLHANDLE Handle);
+
+ #define N3SQLFreeHandle(a,b) (*reinterpret_cast<T3SQLFreeHandle>(getOdbcFunction(ODBC3SQLFunctionId::FreeHandle)))(a,b)
+
+ typedef SQLRETURN (SQL_API *T3SQLGetCursorName) ( SQLHSTMT StatementHandle,
+ SQLCHAR * CursorName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLength2);
+
+ #define N3SQLGetCursorName(a,b,c,d) (*reinterpret_cast<T3SQLGetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::GetCursorName)))(a,b,c,d)
+
+ typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHSTMT ConnectionHandle,
+ SQLCHAR * InStatementText,
+ SQLINTEGER TextLength1,
+ SQLCHAR * OutStatementText,
+ SQLINTEGER BufferLength,
+ SQLINTEGER * TextLength2Ptr);
+
+ #define N3SQLNativeSql(a,b,c,d,e,f) (*reinterpret_cast<T3SQLNativeSql>(getOdbcFunction(ODBC3SQLFunctionId::NativeSql)))(a,b,c,d,e,f)
+
+ // extern declaration of the function pointer
+ extern T3SQLAllocHandle pODBC3SQLAllocHandle;
+ extern T3SQLConnect pODBC3SQLConnect;
+ extern T3SQLDriverConnect pODBC3SQLDriverConnect;
+ extern T3SQLBrowseConnect pODBC3SQLBrowseConnect;
+ extern T3SQLDataSources pODBC3SQLDataSources;
+ extern T3SQLDrivers pODBC3SQLDrivers;
+ extern T3SQLGetInfo pODBC3SQLGetInfo;
+ extern T3SQLGetFunctions pODBC3SQLGetFunctions;
+ extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
+ extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
+ extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
+ extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
+ extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
+ extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
+ extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
+ //extern T3SQLSetDescField pODBC3SQLSetDescField;
+ //extern T3SQLGetDescField pODBC3SQLGetDescField;
+ //extern T3SQLGetDescRec pODBC3SQLGetDescRec;
+ //extern T3SQLSetDescRec pODBC3SQLSetDescRec;
+ extern T3SQLPrepare pODBC3SQLPrepare;
+ extern T3SQLBindParameter pODBC3SQLBindParameter;
+ //extern T3SQLGetCursorName pODBC3SQLGetCursorName;
+ extern T3SQLSetCursorName pODBC3SQLSetCursorName;
+ extern T3SQLExecute pODBC3SQLExecute;
+ extern T3SQLExecDirect pODBC3SQLExecDirect;
+ //extern T3SQLNativeSql pODBC3SQLNativeSql;
+ extern T3SQLDescribeParam pODBC3SQLDescribeParam;
+ extern T3SQLNumParams pODBC3SQLNumParams;
+ extern T3SQLParamData pODBC3SQLParamData;
+ extern T3SQLPutData pODBC3SQLPutData;
+ extern T3SQLRowCount pODBC3SQLRowCount;
+ extern T3SQLNumResultCols pODBC3SQLNumResultCols;
+ extern T3SQLDescribeCol pODBC3SQLDescribeCol;
+ extern T3SQLColAttribute pODBC3SQLColAttribute;
+ extern T3SQLBindCol pODBC3SQLBindCol;
+ extern T3SQLFetch pODBC3SQLFetch;
+ extern T3SQLFetchScroll pODBC3SQLFetchScroll;
+ extern T3SQLGetData pODBC3SQLGetData;
+ extern T3SQLSetPos pODBC3SQLSetPos;
+ extern T3SQLBulkOperations pODBC3SQLBulkOperations;
+ extern T3SQLMoreResults pODBC3SQLMoreResults;
+ //extern T3SQLGetDiagField pODBC3SQLGetDiagField;
+ extern T3SQLGetDiagRec pODBC3SQLGetDiagRec;
+ extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
+ extern T3SQLColumns pODBC3SQLColumns;
+ extern T3SQLForeignKeys pODBC3SQLForeignKeys;
+ extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
+ extern T3SQLProcedureColumns pODBC3SQLProcedureColumns;
+ extern T3SQLProcedures pODBC3SQLProcedures;
+ extern T3SQLSpecialColumns pODBC3SQLSpecialColumns;
+ extern T3SQLStatistics pODBC3SQLStatistics;
+ extern T3SQLTablePrivileges pODBC3SQLTablePrivileges;
+ extern T3SQLTables pODBC3SQLTables;
+ extern T3SQLFreeStmt pODBC3SQLFreeStmt;
+ extern T3SQLCloseCursor pODBC3SQLCloseCursor;
+ extern T3SQLCancel pODBC3SQLCancel;
+ extern T3SQLEndTran pODBC3SQLEndTran;
+ extern T3SQLDisconnect pODBC3SQLDisconnect;
+ extern T3SQLFreeHandle pODBC3SQLFreeHandle;
+ extern T3SQLGetCursorName pODBC3SQLGetCursorName;
+ extern T3SQLNativeSql pODBC3SQLNativeSql;
+}
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
new file mode 100644
index 000000000..c593a859d
--- /dev/null
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -0,0 +1,153 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
+
+#include <odbc/odbcbasedllapi.hxx>
+#include <odbc/OStatement.hxx>
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+
+ class OBoundParam;
+ typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement,
+ css::sdbc::XParameters,
+ css::sdbc::XPreparedBatchExecution,
+ css::sdbc::XResultSetMetaDataSupplier,
+ css::lang::XServiceInfo> OPreparedStatement_BASE;
+
+ class OOO_DLLPUBLIC_ODBCBASE OPreparedStatement final :
+ public OStatement_BASE2,
+ public OPreparedStatement_BASE
+ {
+ static const short invalid_scale = -1;
+
+ // Data attributes
+
+ SQLSMALLINT numParams; // Number of parameter markers for the prepared statement
+
+ std::unique_ptr<OBoundParam[]> boundParams;
+ // Array of bound parameter objects. Each parameter marker will have a
+ // corresponding object to hold bind information, and resulting data.
+ css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData;
+ bool m_bPrepared;
+
+ void FreeParams();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void putParamData (sal_Int32 index);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void setStream (sal_Int32 ParameterIndex,const css::uno::Reference< css::io::XInputStream>& x,
+ SQLLEN length,sal_Int32 SQLtype);
+ SQLLEN* getLengthBuf (sal_Int32 index);
+ void* allocBindBuf ( sal_Int32 index, sal_Int32 bufLen);
+ /// @throws css::sdbc::SQLException
+ void initBoundParam ();
+ void setParameterPre(sal_Int32 parameterIndex);
+ template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, const T i_Value);
+ template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const T i_Value);
+ void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const void* _pData, SQLULEN _nDataLen, SQLLEN _nDataAllocLen);
+ // Wrappers for special cases
+ void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, sal_Int16 _nScale, const OUString &_sData);
+ void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, const css::uno::Sequence< sal_Int8 > &Data);
+
+ bool isPrepared() const { return m_bPrepared;}
+ void prepareStatement();
+ void checkParameterIndex(sal_Int32 _parameterIndex);
+
+ /**
+ creates the driver specific resultset (factory)
+ */
+ virtual OResultSet* createResulSet() override;
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
+ const css::uno::Any& rValue) override;
+ public:
+ DECLARE_SERVICE_INFO();
+ // A ctor, needed to return the object
+ OPreparedStatement( OConnection* _pConnection,const OUString& sql);
+ virtual ~OPreparedStatement() override;
+ OPreparedStatement& operator=( OPreparedStatement const & ) = delete; // MSVC2015 workaround
+ OPreparedStatement( OPreparedStatement const & ) = delete; // MSVC2015 workaround
+
+ //XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() throw() override;
+ virtual void SAL_CALL release() throw() override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ // XPreparedStatement
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override;
+ virtual sal_Int32 SAL_CALL executeUpdate( ) override;
+ virtual sal_Bool SAL_CALL execute( ) override;
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override;
+ // XParameters
+ virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override;
+ virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override;
+ virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override;
+ virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override;
+ virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override;
+ virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override;
+ virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override;
+ virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override;
+ virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override;
+ virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override;
+ virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override;
+ virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override;
+ virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override;
+ virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override;
+ virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
+ virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
+ virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override;
+ virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override;
+ virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override;
+ virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override;
+ virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override;
+ virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override;
+ virtual void SAL_CALL clearParameters( ) override;
+ // XPreparedBatchExecution
+ virtual void SAL_CALL addBatch( ) override;
+ virtual void SAL_CALL clearBatch( ) override;
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override;
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
+
+ public:
+ using OStatement_Base::executeQuery;
+ using OStatement_Base::executeUpdate;
+ using OStatement_Base::execute;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx
new file mode 100644
index 000000000..960db1824
--- /dev/null
+++ b/connectivity/source/inc/odbc/OResultSet.hxx
@@ -0,0 +1,358 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
+
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <odbc/OFunctions.hxx>
+#include <odbc/OStatement.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/FValue.hxx>
+#include <TSkipDeletedSet.hxx>
+#include <memory>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+
+ /*
+ ** java_sql_ResultSet
+ */
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
+ css::sdbc::XRow,
+ css::sdbc::XResultSetMetaDataSupplier,
+ css::util::XCancellable,
+ css::sdbc::XWarningsSupplier,
+ css::sdbc::XResultSetUpdate,
+ css::sdbc::XRowUpdate,
+ css::sdbcx::XRowLocate,
+ css::sdbcx::XDeleteRows,
+ css::sdbc::XCloseable,
+ css::sdbc::XColumnLocate,
+ css::lang::XServiceInfo> OResultSet_BASE;
+
+
+ typedef std::pair<sal_Int64,sal_Int32> TVoidPtr;
+ typedef std::allocator< TVoidPtr > TVoidAlloc;
+ typedef std::vector<TVoidPtr> TVoidVector;
+ /// Functor object for class ZZ returntype is void
+ struct OOO_DLLPUBLIC_ODBCBASE TBookmarkPosMapCompare
+ {
+ bool operator()( const css::uno::Sequence<sal_Int8>& _rLH,
+ const css::uno::Sequence<sal_Int8>& _rRH) const
+ {
+ if(_rLH.getLength() == _rRH.getLength())
+ {
+ sal_Int32 nCount = _rLH.getLength();
+ if(nCount != 4)
+ {
+ const sal_Int8* pLHBack = _rLH.getConstArray() + nCount - 1;
+ const sal_Int8* pRHBack = _rRH.getConstArray() + nCount - 1;
+
+ sal_Int32 i;
+ for(i=0;i < nCount;++i,--pLHBack,--pRHBack)
+ {
+ if(!(*pLHBack) && *pRHBack)
+ return true;
+ else if(*pLHBack && !(*pRHBack))
+ return false;
+ }
+ for(i=0,++pLHBack,++pRHBack;i < nCount;++pLHBack,++pRHBack,++i)
+ if(*pLHBack < *pRHBack)
+ return true;
+ return false;
+ }
+ else
+ return *reinterpret_cast<const sal_Int32*>(_rLH.getConstArray()) < *reinterpret_cast<const sal_Int32*>(_rRH.getConstArray());
+
+ }
+ else
+ return _rLH.getLength() < _rRH.getLength();
+ }
+ };
+
+ typedef std::map< css::uno::Sequence<sal_Int8>, sal_Int32,TBookmarkPosMapCompare > TBookmarkPosMap;
+
+ class OOO_DLLPUBLIC_ODBCBASE OResultSet :
+ public cppu::BaseMutex,
+ public ::connectivity::IResultSetHelper,
+ public OResultSet_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
+ {
+ protected:
+ TBookmarkPosMap m_aPosToBookmarks;
+ // used top hold the information about the value and the datatype to save calls to metadata
+ typedef std::vector<ORowSetValue> TDataRow;
+
+ TVoidVector m_aBindVector;
+ std::vector<SQLLEN> m_aLengthVector;
+ std::map<sal_Int32,SWORD> m_aODBCColumnTypes;
+
+ // In baseline ODBC, SQLGetData can only be called on monotonically increasing column numbers.
+ // additionally, any variable-length data can be fetched only once (possibly in parts);
+ // after that, SQLGetData returns SQL_NO_DATA.
+ // In order to insulate our callers from these restrictions,
+ // we cache the current row in m_aRow.
+ // If the driver claims to support the GD_ANY_ORDER extension,
+ // we read and cache only the columns requested by a caller.
+ // Else, we read and cache all columns whose number is <= a requested column.
+ // m_aRow[colNumber].getBound() says if it contains an up-to-date value or not.
+ TDataRow m_aRow;
+ bool m_bFetchDataInOrder;
+ SQLHANDLE m_aStatementHandle;
+ SQLHANDLE m_aConnectionHandle;
+ OStatement_Base* m_pStatement;
+ std::unique_ptr<OSkipDeletedSet> m_pSkipDeletedSet;
+ css::uno::Reference< css::uno::XInterface> m_xStatement;
+ css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
+ std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray;
+ rtl_TextEncoding m_nTextEncoding;
+ sal_Int32 m_nRowPos;
+ mutable sal_uInt32 m_nUseBookmarks;
+ SQLRETURN m_nCurrentFetchState;
+ bool m_bWasNull;
+ bool m_bEOF; // after last record
+ bool m_bRowInserted;
+ bool m_bRowDeleted;
+ bool m_bUseFetchScroll;
+
+ bool isBookmarkable() const;
+ sal_Int32 getResultSetConcurrency() const;
+ sal_Int32 getResultSetType() const;
+ static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; }
+ sal_Int32 getFetchSize() const;
+ OUString getCursorName() const;
+ template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const;
+
+ void setFetchDirection(sal_Int32 _par0);
+ void setFetchSize(sal_Int32 _par0);
+ template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const;
+
+
+ void ensureCacheForColumn(sal_Int32 columnIndex);
+ void invalidateCache();
+ void fillColumn(sal_Int32 _nToColumn);
+ void allocBuffer();
+ void releaseBuffer();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void updateValue(sal_Int32 columnIndex, SQLSMALLINT _nType, void const * _pValue);
+ void fillNeededData(SQLRETURN _nRet);
+ bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset);
+ TVoidPtr allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex);
+ SQLRETURN unbind(bool _bUnbindHandle = true);
+ SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex);
+
+ // helper to implement XRow::getXXX in simple cases
+ template < typename T > T getValue( sal_Int32 columnIndex );
+ // impl_getXXX are the functions that do the actual fetching from ODBC, ignoring the cache
+ // for simple cases
+ template < typename T > T impl_getValue( const sal_Int32 _nColumnIndex, SQLSMALLINT nType );
+ // these cases need some special treatment
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ bool impl_getBoolean( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< sal_Int8 > impl_getBytes( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::util::Date impl_getDate( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::util::Time impl_getTime( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::util::DateTime impl_getTimestamp( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ sal_Int64 impl_getLong( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ OUString impl_getString( sal_Int32 columnIndex );
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence<sal_Int8> impl_getBookmark( );
+
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue
+ ) override;
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const override;
+ public:
+ DECLARE_SERVICE_INFO();
+ // A ctor that is needed for returning the object
+ OResultSet( SQLHANDLE _pStatementHandle,OStatement_Base* pStmt);
+ virtual ~OResultSet() override;
+
+ void construct();
+
+ oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
+ {
+ return m_pStatement->getOdbcFunction(_nIndex);
+ }
+
+ css::uno::Reference< css::uno::XInterface > operator *()
+ {
+ return css::uno::Reference< css::uno::XInterface >(*static_cast<OResultSet_BASE*>(this));
+ }
+
+ void setMetaData(const css::uno::Reference< css::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;}
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() throw() override;
+ virtual void SAL_CALL release() throw() override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // XResultSet
+ virtual sal_Bool SAL_CALL next( ) override;
+ virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
+ virtual sal_Bool SAL_CALL isAfterLast( ) override;
+ virtual sal_Bool SAL_CALL isFirst( ) override;
+ virtual sal_Bool SAL_CALL isLast( ) override;
+ virtual void SAL_CALL beforeFirst( ) override;
+ virtual void SAL_CALL afterLast( ) override;
+ virtual sal_Bool SAL_CALL first( ) override;
+ virtual sal_Bool SAL_CALL last( ) override;
+ virtual sal_Int32 SAL_CALL getRow( ) override;
+ virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
+ virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
+ virtual sal_Bool SAL_CALL previous( ) override;
+ virtual void SAL_CALL refreshRow( ) override;
+ virtual sal_Bool SAL_CALL rowUpdated( ) override;
+ virtual sal_Bool SAL_CALL rowInserted( ) override;
+ virtual sal_Bool SAL_CALL rowDeleted( ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
+ // XRow
+ virtual sal_Bool SAL_CALL wasNull( ) override;
+ virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
+ virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
+ virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
+ virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
+ virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
+ virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
+ virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
+ virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
+ virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
+ virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
+ virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
+ virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
+ virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
+ virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
+ // XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
+ // XCancellable
+ virtual void SAL_CALL cancel( ) override;
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings( ) override;
+ virtual void SAL_CALL clearWarnings( ) override;
+ // XResultSetUpdate
+ virtual void SAL_CALL insertRow( ) override;
+ virtual void SAL_CALL updateRow( ) override;
+ virtual void SAL_CALL deleteRow( ) override;
+ virtual void SAL_CALL cancelRowUpdates( ) override;
+ virtual void SAL_CALL moveToInsertRow( ) override;
+ virtual void SAL_CALL moveToCurrentRow( ) override;
+ // XRowUpdate
+ virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override;
+ virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override;
+ virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override;
+ virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override;
+ virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override;
+ virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override;
+ virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override;
+ virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override;
+ virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override;
+ virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override;
+ virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override;
+ virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override;
+ virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override;
+ virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
+ virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
+ virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override;
+ virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override;
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
+ // XRowLocate
+ virtual css::uno::Any SAL_CALL getBookmark( ) override;
+ virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override;
+ virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override;
+ virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override;
+ virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override;
+ virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override;
+ // XDeleteRows
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override;
+
+ // IResultSetHelper
+ virtual bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) override;
+ virtual sal_Int32 getDriverPos() const override;
+ virtual bool isRowDeleted() const override;
+
+ protected:
+ using OPropertySetHelper::getFastPropertyValue;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
new file mode 100644
index 000000000..b1ffb20ce
--- /dev/null
+++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
@@ -0,0 +1,120 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
+
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <odbc/OFunctions.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <vector>
+#include <odbc/OConnection.hxx>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+
+ //************ Class: ResultSetMetaData
+
+ typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
+
+ class OOO_DLLPUBLIC_ODBCBASE OResultSetMetaData final :
+ public OResultSetMetaData_BASE
+ {
+ std::vector<sal_Int32> m_vMapping; // when not every column is needed
+ std::map<sal_Int32,sal_Int32> m_aColumnTypes;
+
+ SQLHANDLE m_aStatementHandle;
+ OConnection* m_pConnection;
+ sal_Int32 m_nColCount;
+ bool m_bUseODBC2Types;
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident);
+ public:
+ // A ctor that is needed for returning the object
+ OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt )
+ :m_aStatementHandle( _pStmt )
+ ,m_pConnection(_pConnection)
+ ,m_nColCount(-1)
+ ,m_bUseODBC2Types(false)
+ {}
+ OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ,const std::vector<sal_Int32> & _vMapping)
+ :m_vMapping(_vMapping)
+ ,m_aStatementHandle( _pStmt )
+ ,m_pConnection(_pConnection)
+ ,m_nColCount(_vMapping.size()-1)
+ ,m_bUseODBC2Types(false)
+ {}
+ virtual ~OResultSetMetaData() override;
+
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static SQLLEN getNumColAttrib(OConnection const * _pConnection
+ ,SQLHANDLE _aStatementHandle
+ ,const css::uno::Reference< css::uno::XInterface >& _xInterface
+ ,sal_Int32 _column
+ ,sal_Int32 ident);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static SQLSMALLINT getColumnODBCType(OConnection const * _pConnection
+ ,SQLHANDLE _aStatementHandle
+ ,const css::uno::Reference< css::uno::XInterface >& _xInterface
+ ,sal_Int32 column);
+
+ oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
+ {
+ return m_pConnection->getOdbcFunction(_nIndex);
+ }
+
+ virtual sal_Int32 SAL_CALL getColumnCount( ) override;
+ virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override;
+ virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override;
+ virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override;
+ virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override;
+ virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getTableName( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override;
+ virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override;
+ virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override;
+ virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx
new file mode 100644
index 000000000..5beaf9bb6
--- /dev/null
+++ b/connectivity/source/inc/odbc/OStatement.hxx
@@ -0,0 +1,247 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
+
+#include <com/sun/star/sdbc/XStatement.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbc/XMultipleResults.hpp>
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <odbc/OFunctions.hxx>
+#include <odbc/OConnection.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <vector>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace odbc
+ {
+
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement,
+ css::sdbc::XWarningsSupplier,
+ css::util::XCancellable,
+ css::sdbc::XCloseable,
+ css::sdbc::XGeneratedResultSet,
+ css::sdbc::XMultipleResults> OStatement_BASE;
+
+ class OResultSet;
+
+ //************ Class: java.sql.Statement
+
+ class OOO_DLLPUBLIC_ODBCBASE OStatement_Base :
+ public cppu::BaseMutex,
+ public OStatement_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
+
+ {
+ css::sdbc::SQLWarning m_aLastWarning;
+ protected:
+ css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
+ css::uno::Reference< css::sdbc::XStatement> m_xGeneratedStatement;
+ // for this Statement
+
+ std::vector< OUString> m_aBatchVector;
+ OUString m_sSqlStatement;
+
+ rtl::Reference<OConnection> m_pConnection;// The owning Connection object
+ SQLHANDLE m_aStatementHandle;
+ SQLUSMALLINT* m_pRowStatusArray;
+
+ protected:
+
+ sal_Int64 getQueryTimeOut() const;
+ sal_Int64 getMaxFieldSize() const;
+ sal_Int64 getMaxRows() const;
+ sal_Int32 getResultSetConcurrency() const;
+ sal_Int32 getResultSetType() const;
+ sal_Int32 getFetchDirection() const;
+ sal_Int32 getFetchSize() const;
+ OUString getCursorName() const;
+ bool isUsingBookmarks() const;
+ bool getEscapeProcessing() const;
+ template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const;
+
+ void setQueryTimeOut(sal_Int64 _par0) ;
+ void setMaxFieldSize(sal_Int64 _par0) ;
+ void setMaxRows(sal_Int64 _par0) ;
+ void setFetchDirection(sal_Int32 _par0) ;
+ void setFetchSize(sal_Int32 _par0) ;
+ void setCursorName(const OUString &_par0);
+ void setEscapeProcessing( const bool _bEscapeProc );
+ template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const;
+
+ void setResultSetConcurrency(sal_Int32 _par0) ;
+ void setResultSetType(sal_Int32 _par0) ;
+ void setUsingBookmarks(bool _bUseBookmark) ;
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void reset();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void clearMyResultSet();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void setWarning (const css::sdbc::SQLWarning &ex);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ bool lockIfNecessary (const OUString& sql);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ sal_Int32 getColumnCount();
+
+
+ // getResultSet
+ // getResultSet returns the current result as a ResultSet. It
+ // returns NULL if the current result is not a ResultSet.
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference<css::sdbc::XResultSet> getResultSet(bool checkCount);
+ /**
+ creates the driver specific resultset (factory)
+ */
+ virtual OResultSet* createResulSet();
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ SQLLEN getRowCount();
+
+
+ void disposeResultSet();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ css::uno::Any & rConvertedValue,
+ css::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const css::uno::Any& rValue
+ ) override;
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const override;
+ virtual ~OStatement_Base() override;
+
+ public:
+ OStatement_Base(OConnection* _pConnection );
+ using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >;
+
+ oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
+ {
+ return m_pConnection->getOdbcFunction(_nIndex);
+ }
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ // XInterface
+ virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() throw() override;
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+ // XStatement
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ;
+ virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ;
+ virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ;
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ;
+ // XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings( ) override;
+ virtual void SAL_CALL clearWarnings( ) override;
+ // XCancellable
+ virtual void SAL_CALL cancel( ) override;
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XMultipleResults
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override;
+ virtual sal_Int32 SAL_CALL getUpdateCount( ) override;
+ virtual sal_Bool SAL_CALL getMoreResults( ) override;
+ //XGeneratedResultSet
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) override;
+
+ // other methods
+ SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); }
+ OConnection* getOwnConnection() const { return m_pConnection.get();}
+ /** getCursorProperties return the properties for a specific cursor type
+ @param _nCursorType the CursorType
+ @param bFirst when true the first property set is returned
+
+ @return the cursor properties
+ */
+ SQLUINTEGER getCursorProperties(SQLINTEGER _nCursorType, bool bFirst);
+
+ protected:
+ using OPropertySetHelper::getFastPropertyValue;
+ };
+
+ class OOO_DLLPUBLIC_ODBCBASE OStatement_BASE2 : public OStatement_Base
+ {
+ public:
+ OStatement_BASE2(OConnection* _pConnection ) :
+ OStatement_Base(_pConnection )
+ {}
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+ };
+
+ class OOO_DLLPUBLIC_ODBCBASE OStatement :
+ public OStatement_BASE2,
+ public css::sdbc::XBatchExecution,
+ public css::lang::XServiceInfo
+ {
+ protected:
+ virtual ~OStatement() override {}
+ public:
+ // A ctor that is needed for returning the object
+ OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
+ DECLARE_SERVICE_INFO();
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() throw() override;
+ virtual void SAL_CALL release() throw() override;
+ // XBatchExecution
+ virtual void SAL_CALL addBatch( const OUString& sql ) override;
+ virtual void SAL_CALL clearBatch( ) override;
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx
new file mode 100644
index 000000000..3f2fddb81
--- /dev/null
+++ b/connectivity/source/inc/odbc/OTools.hxx
@@ -0,0 +1,250 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
+
+#include <connectivity/odbc.hxx>
+#include <odbc/odbcbasedllapi.hxx>
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <osl/thread.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/textenc.h>
+
+enum class ODBC3SQLFunctionId
+{
+ AllocHandle = 1,
+ Connect = 2,
+ DriverConnect = 3,
+ BrowseConnect = 4,
+ DataSources = 5,
+ Drivers = 6,
+ GetInfo = 7,
+ GetFunctions = 8,
+ GetTypeInfo = 9,
+ SetConnectAttr = 10,
+ GetConnectAttr = 11,
+ SetEnvAttr = 12,
+ GetEnvAttr = 13,
+ SetStmtAttr = 14,
+ GetStmtAttr = 15,
+ Prepare = 16,
+ BindParameter = 17,
+ SetCursorName = 18,
+ Execute = 19,
+ ExecDirect = 20,
+ DescribeParam = 21,
+ NumParams = 22,
+ ParamData = 23,
+ PutData = 24,
+ RowCount = 25,
+ NumResultCols = 26,
+ DescribeCol = 27,
+ ColAttribute = 28,
+ BindCol = 29,
+ Fetch = 30,
+ FetchScroll = 31,
+ GetData = 32,
+ SetPos = 33,
+ BulkOperations = 34,
+ MoreResults = 35,
+ GetDiagRec = 36,
+ ColumnPrivileges = 37,
+ Columns = 38,
+ ForeignKeys = 39,
+ PrimaryKeys = 40,
+ ProcedureColumns = 41,
+ Procedures = 42,
+ SpecialColumns = 43,
+ Statistics = 44,
+ TablePrivileges = 45,
+ Tables = 46,
+ FreeStmt = 47,
+ CloseCursor = 48,
+ Cancel = 49,
+ EndTran = 50,
+ Disconnect = 51,
+ FreeHandle = 52,
+ GetCursorName = 53,
+ NativeSql = 54,
+};
+
+namespace connectivity
+{
+ namespace odbc
+ {
+ class OConnection;
+
+ const sal_Int32 MAX_PUT_DATA_LENGTH = 2000;
+
+ class OOO_DLLPUBLIC_ODBCBASE OTools
+ {
+ public:
+ /// @throws css::sdbc::SQLException
+ static void ThrowException( const OConnection* _pConnection,
+ SQLRETURN _rRetCode,
+ SQLHANDLE _pContext,
+ SQLSMALLINT _nHandleType,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ bool _bNoFound=true);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void GetInfo(OConnection const * _pConnection,
+ SQLHANDLE _aConnectionHandle,
+ SQLUSMALLINT _nInfo,
+ OUString &_rValue,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ rtl_TextEncoding _nTextEncoding);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void GetInfo(OConnection const * _pConnection,
+ SQLHANDLE _aConnectionHandle,
+ SQLUSMALLINT _nInfo,
+ sal_Int32 &_rValue,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void GetInfo(OConnection const * _pConnection,
+ SQLHANDLE _aConnectionHandle,
+ SQLUSMALLINT _nInfo,
+ SQLUSMALLINT &_rValue,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void GetInfo(OConnection const * _pConnection,
+ SQLHANDLE _aConnectionHandle,
+ SQLUSMALLINT _nInfo,
+ SQLUINTEGER &_rValue,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface);
+
+ static sal_Int32 MapOdbcType2Jdbc(SQLSMALLINT _nType);
+ static SQLSMALLINT jdbcTypeToOdbc(sal_Int32 jdbcType);
+
+ static DATE_STRUCT DateToOdbcDate(const css::util::Date& x)
+ {
+ DATE_STRUCT aVal;
+ aVal.year = x.Year;
+ aVal.month = x.Month;
+ aVal.day = x.Day;
+ return aVal;
+ }
+ static TIME_STRUCT TimeToOdbcTime(const css::util::Time& x)
+ {
+ TIME_STRUCT aVal;
+ aVal.hour = x.Hours;
+ aVal.minute = x.Minutes;
+ aVal.second = x.Seconds;
+ return aVal;
+ }
+ static TIMESTAMP_STRUCT DateTimeToTimestamp(const css::util::DateTime& x)
+ {
+ TIMESTAMP_STRUCT aVal;
+ aVal.year = x.Year;
+ aVal.month = x.Month;
+ aVal.day = x.Day;
+ aVal.hour = x.Hours;
+ aVal.minute = x.Minutes;
+ aVal.second = x.Seconds;
+ aVal.fraction = x.NanoSeconds;
+ return aVal;
+ }
+ /**
+ getBindTypes set the ODBC type for C
+ @param _bUseWChar true when Unicode should be used
+ @param _bUseOldTimeDate true when the old datetime format should be used
+ @param _nOdbcType the ODBC sql type
+ @param fCType the C type for the ODBC type
+ @param fSqlType the SQL type for the ODBC type
+ */
+ static void getBindTypes(bool _bUseWChar,
+ bool _bUseOldTimeDate,
+ SQLSMALLINT _nOdbcType,
+ SQLSMALLINT& fCType,
+ SQLSMALLINT& fSqlType);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static OUString getStringValue( OConnection const * _pConnection,
+ SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _fSqlType,
+ bool &_bWasNull,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ rtl_TextEncoding _nTextEncoding);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence<sal_Int8> getBytesValue(const OConnection* _pConnection,
+ SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _fSqlType,
+ bool &_bWasNull,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface);
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void getValue( OConnection const * _pConnection,
+ SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _nType,
+ bool &_bWasNull,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ void* _pValue,
+ SQLLEN _nSize);
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ static void bindValue( OConnection const * _pConnection,
+ SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _nType,
+ SQLSMALLINT _nMaxLen,
+ const void* _pValue,
+ void* _pData,
+ SQLLEN *pLen,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ rtl_TextEncoding _nTextEncoding,
+ bool _bUseOldTimeDate);
+ };
+
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ template <class T> void getValue( const OConnection* _pConnection,
+ SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _nType,
+ bool &_bWasNull,
+ const css::uno::Reference< css::uno::XInterface >& _xInterface,
+ T& _rValue)
+ {
+ OTools::getValue(_pConnection,_aStatementHandle,columnIndex,_nType,_bWasNull,_xInterface,&_rValue,sizeof _rValue);
+ }
+
+
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/odbcbasedllapi.hxx b/connectivity/source/inc/odbc/odbcbasedllapi.hxx
new file mode 100644
index 000000000..59619eee7
--- /dev/null
+++ b/connectivity/source/inc/odbc/odbcbasedllapi.hxx
@@ -0,0 +1,35 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined OOO_DLLIMPLEMENTATION_ODBCBASE
+#define OOO_DLLPUBLIC_ODBCBASE SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_ODBCBASE SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */