diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /connectivity/source/inc/ado | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
36 files changed, 3794 insertions, 0 deletions
diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx new file mode 100644 index 000000000..6d6979e40 --- /dev/null +++ b/connectivity/source/inc/ado/ACallableStatement.hxx @@ -0,0 +1,81 @@ +/* -*- 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_ADO_ACALLABLESTATEMENT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACALLABLESTATEMENT_HXX + +#include <ado/APreparedStatement.hxx> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XOutParameters.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + + //************ Class: java.sql.CallableStatement + + + class OCallableStatement : public OPreparedStatement, + public css::sdbc::XRow, + public css::sdbc::XOutParameters + { + OLEVariant m_aValue; + public: + DECLARE_SERVICE_INFO(); + + // a Constructor, that is needed for when Returning the Object is needed: + OCallableStatement( OConnection* _pConnection, const OUString& sql ); + + 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; + + // 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; + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) override; + }; + } +} +#endif // _CONNECTIVITY_OCallableStatement_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ACatalog.hxx b/connectivity/source/inc/ado/ACatalog.hxx new file mode 100644 index 000000000..d1d8e22bf --- /dev/null +++ b/connectivity/source/inc/ado/ACatalog.hxx @@ -0,0 +1,54 @@ +/* -*- 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_ADO_ACATALOG_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACATALOG_HXX + +#include <sdbcx/VCatalog.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + + class OCatalog : public connectivity::sdbcx::OCatalog + { + WpADOCatalog m_aCatalog; + OConnection* m_pConnection; + + public: + virtual void refreshTables() override; + virtual void refreshViews() override; + virtual void refreshGroups() override; + virtual void refreshUsers() override; + + public: + OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon); + ~OCatalog() override; + + OConnection* getConnection() const { return m_pConnection; } + sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } + WpADOCatalog getCatalog() const { return m_aCatalog; } + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACATALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx new file mode 100644 index 000000000..cc49f3b36 --- /dev/null +++ b/connectivity/source/inc/ado/AColumn.hxx @@ -0,0 +1,60 @@ +/* -*- 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_ADO_ACOLUMN_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMN_HXX + +#include <connectivity/sdbcx/VColumn.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + typedef sdbcx::OColumn OColumn_ADO; + class OAdoColumn : public OColumn_ADO + { + WpADOColumn m_aColumn; + OConnection* m_pConnection; + OUString m_ReferencedColumn; + bool m_IsAscending; + + void fillPropertyValues(); + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue + ) override; + public: + OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn); + OAdoColumn(bool _bCase,OConnection* _pConnection); + // ODescriptor + virtual void construct() override; + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + WpADOColumn getColumnImpl() const; + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx new file mode 100644 index 000000000..6b605df7c --- /dev/null +++ b/connectivity/source/inc/ado/AColumns.hxx @@ -0,0 +1,61 @@ +/* -*- 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_ADO_ACOLUMNS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMNS_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OColumns : public sdbcx::OCollection + { + protected: + WpADOColumns m_aCollection; + OConnection* m_pConnection; + + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOColumns& _rCollection, + bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } + + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMNS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx new file mode 100644 index 000000000..21bc9129c --- /dev/null +++ b/connectivity/source/inc/ado/AConnection.hxx @@ -0,0 +1,138 @@ +/* -*- 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_ADO_ACONNECTION_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACONNECTION_HXX + +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <map> +#include <connectivity/CommonTools.hxx> +#include <OTypeInfo.hxx> +#include <TConnection.hxx> +#include <ado/Awrapado.hxx> + +namespace connectivity +{ + namespace ado + { + struct OExtendedTypeInfo + { + ::connectivity::OTypeInfo aSimpleType; // the general type info + DataTypeEnum eType; + + OUString getDBName() const { return aSimpleType.aTypeName; } + }; + + class WpADOConnection; + class ODriver; + class OCatalog; + typedef std::multimap<DataTypeEnum, OExtendedTypeInfo*> OTypeInfoMap; + typedef connectivity::OMetaConnection OConnection_BASE; + + + class OConnection : public OConnection_BASE + { + protected: + + // Data attributes + + OTypeInfoMap m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + css::uno::WeakReference< css::sdbcx::XTablesSupplier> m_xCatalog; + ODriver* m_pDriver; + private: + WpADOConnection* m_pAdoConnection; + OCatalog* m_pCatalog; + sal_Int32 m_nEngineType; + bool m_bClosed; + bool m_bAutocommit; + + protected: + /// @throws css::sdbc::SQLException + void buildTypeInfo(); + public: + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OConnection(ODriver* _pDriver); + // OConnection(const SQLHANDLE _pConnectionHandle); + ~OConnection() override; + void construct(const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + // XServiceInfo + DECLARE_SERVICE_INFO(); + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // 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; + + WpADOConnection* getConnection() { return m_pAdoConnection; } + void setCatalog(const css::uno::WeakReference< css::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; } + void setCatalog(OCatalog* _pCatalog) { m_pCatalog = _pCatalog; } + + const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;} + OCatalog* getAdoCatalog() const + { + if ( m_xCatalog.get().is() ) + return m_pCatalog; + return nullptr; + } + + sal_Int32 getEngineType() const { return m_nEngineType; } + ODriver* getDriver() const { return m_pDriver; } + + static const OExtendedTypeInfo* getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, + DataTypeEnum _nType, + const OUString& _sTypeName, + sal_Int32 _nPrecision, + sal_Int32 _nScale, + bool& _brForceToType); + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACONNECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADatabaseMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaData.hxx new file mode 100644 index 000000000..83a84f3bd --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaData.hxx @@ -0,0 +1,226 @@ +/* -*- 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_ADO_ADATABASEMETADATA_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX + +#include <TDatabaseMetaDataBase.hxx> +#include <map> + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + class OConnection; + + //************ Class: ODatabaseMetaData + + + class ODatabaseMetaData : public ODatabaseMetaDataBase + { + struct LiteralInfo + { + OUString pwszLiteralValue; + sal_uInt32 cchMaxLen; + bool fSupported; + }; + + std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; + WpADOConnection* m_pADOConnection; + OConnection* m_pConnection; + + void fillLiterals(); + // get information out of rowset + sal_Int32 getMaxSize(sal_uInt32 _nId); + bool isCapable(sal_uInt32 _nId); + OUString getLiteral(sal_uInt32 _nProperty); + + // get info out of properties + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString getStringProperty(const OUString& _aProperty); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getInt32Property(const OUString& _aProperty); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + bool getBoolProperty(const OUString& _aProperty); + + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + // 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; + public: + + ODatabaseMetaData(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 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_ADO_ADATABASEMETADATA_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000..4d99bdce3 --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -0,0 +1,230 @@ +/* -*- 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_ADO_ADATABASEMETADATARESULTSET_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX + +#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 <ado/AStatement.hxx> + +namespace connectivity +{ + namespace ado + { + /* + ** 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 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, ::std::map<sal_Int32,sal_Int32> >::iterator m_aValueRangeIter; + + std::map<sal_Int32, std::map< OUString,sal_Int32> > m_aStrValueRange; + std::map<sal_Int32, std::map< OUString,sal_Int32> >::iterator m_aStrValueRangeIter; + + std::map<sal_Int32, std::map< sal_Int32,OUString> > m_aIntValueRange; + std::map<sal_Int32, std::map< sal_Int32,OUString> >::iterator m_aIntValueRangeIter; + + ADORecordset* m_pRecordSet; + css::uno::WeakReferenceHelper m_aStatement; + css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + bool m_bWasNull; + bool m_bEOF; + bool m_bOnFirstAfterOpen; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getResultSetConcurrency(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getResultSetType(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static OUString getCursorName(); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + + + inline sal_Int32 mapColumn (sal_Int32 column); + /// @throws css::sdbc::SQLException + void checkRecordSet(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OLEVariant getValue(sal_Int32 columnIndex ); + + 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; + public: + // a Constructor, that is needed for when Returning the Object is needed: + ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet); + ~ODatabaseMetaDataResultSet() override; + + // ::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; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + + const std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; } + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(bool _bJetEngine); + }; + + inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) + { + sal_Int32 map = column; + + if (!m_aColMapping.empty()) + { + // Validate column number + map = m_aColMapping[column]; + } + + return map; + } + } + +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000..714aa9136 --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,107 @@ +/* -*- 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_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase.hxx> +#include <vector> +#include <ado/Awrapado.hxx> +#include <ado/ADatabaseMetaDataResultSet.hxx> +#include <OColumn.hxx> + +namespace connectivity +{ + namespace ado + { + + //************ Class: ResultSetMetaData + + typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; + + const std::vector<sal_Int32> &m_vMapping; // when not every column is needed + std::map<sal_Int32,connectivity::OColumn> m_mColumns; + std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + private: + ODatabaseMetaDataResultSetMetaData( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + ODatabaseMetaDataResultSetMetaData& operator=( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + public: + // a Constructor, that is needed for when Returning the Object is needed: + ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet ,ODatabaseMetaDataResultSet* _pRes) + : m_vMapping(_pRes->getColumnMapping()), + m_pRecordSet(_pRecordSet), + m_nColCount(m_vMapping.size()-1) + { + if(m_pRecordSet) + m_pRecordSet->AddRef(); + } + ~ODatabaseMetaDataResultSetMetaData() override; + + /// Avoid ambiguous cast error from the compiler. + operator css::uno::Reference< css::sdbc::XResultSetMetaData > () throw() + { return this; } + + 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 // _CONNECTIVITY_ADO_ADATABASEMETARESULTSETMETADATA_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx new file mode 100644 index 000000000..22b23b4ca --- /dev/null +++ b/connectivity/source/inc/ado/ADriver.hxx @@ -0,0 +1,90 @@ +/* -*- 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_ADO_ADRIVER_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADRIVER_HXX + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase.hxx> +#include <connectivity/CommonTools.hxx> + +namespace com::sun::star::lang { class XMultiServiceFactory; } + +namespace connectivity +{ + namespace ado + { + /// @throws css::uno::Exception + css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::sdbcx::XDataDefinitionSupplier, + css::lang::XServiceInfo + > ODriver_BASE; + class ODriver : public ODriver_BASE + { + ::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; + + + public: + ODriver(const css::uno::Reference< css::lang::XMultiServiceFactory >& _xORB); + ~ODriver() override; + + // 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( ); + css::uno::Reference< css::lang::XMultiServiceFactory > getORB() const { return m_xORB; } + + private: + void impl_checkURL_throw(const OUString& _sUrl); + + // 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; + + // XDataDefinitionSupplier + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + }; + } + +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADRIVER_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx new file mode 100644 index 000000000..2b3f36fff --- /dev/null +++ b/connectivity/source/inc/ado/AGroup.hxx @@ -0,0 +1,67 @@ +/* -*- 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_ADO_AGROUP_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUP_HXX + +#include <sdbcx/VGroup.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OGroup OGroup_ADO; + class OCatalog; + + class OAdoGroup : public OGroup_ADO + { + WpADOGroup m_aGroup; + OCatalog* m_pCatalog; + + static sal_Int32 MapRight(RightsEnum _eNum); + static RightsEnum Map2Right(sal_Int32 _eNum); + static ObjectTypeEnum MapObjectType(sal_Int32 ObjType); + protected: + virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue,sal_Int32 nHandle) const override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + + public: + virtual void refreshUsers() override; + public: + OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup=nullptr); + OAdoGroup(OCatalog* _pParent,bool _bCase, const OUString& Name); + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + + WpADOGroup getImpl() const { return m_aGroup; } + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx new file mode 100644 index 000000000..1676b9a6c --- /dev/null +++ b/connectivity/source/inc/ado/AGroups.hxx @@ -0,0 +1,57 @@ +/* -*- 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_ADO_AGROUPS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUPS_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <ado/Awrapadox.hxx> +#include <ado/ACatalog.hxx> + +namespace connectivity +{ + namespace ado + { + class OGroups : public sdbcx::OCollection + { + WpADOGroups m_aCollection; + OCatalog* m_pCatalog; + protected: + + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OGroups(OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOGroups& _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUPS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx new file mode 100644 index 000000000..b31bef3f8 --- /dev/null +++ b/connectivity/source/inc/ado/AIndex.hxx @@ -0,0 +1,54 @@ +/* -*- 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_ADO_AINDEX_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEX_HXX + +#include <sdbcx/VIndex.hxx> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OAdoIndex : public sdbcx::OIndex + { + WpADOIndex m_aIndex; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + public: + virtual void refreshColumns() override; + public: + OAdoIndex(bool _bCase, OConnection* _pConnection,ADOIndex* _pIndex); + OAdoIndex(bool _bCase, OConnection* _pConnection); + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + WpADOIndex getImpl() const { return m_aIndex;} + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx new file mode 100644 index 000000000..4c253cac5 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexes.hxx @@ -0,0 +1,59 @@ +/* -*- 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_ADO_AINDEXES_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEXES_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OIndexes : public sdbcx::OCollection + { + WpADOIndexes m_aCollection; + OConnection* m_pConnection; + protected: + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OIndexes(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOIndexes& _rCollection, + bool _bCase, + OConnection* _pConnection) + : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + , m_aCollection(_rCollection) + , m_pConnection(_pConnection) + { + } + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEXES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx new file mode 100644 index 000000000..bd0b5a640 --- /dev/null +++ b/connectivity/source/inc/ado/AKey.hxx @@ -0,0 +1,64 @@ +/* -*- 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_ADO_AKEY_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEY_HXX + +#include <sdbcx/VKey.hxx> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OKey OKey_ADO; + + class OConnection; + class OAdoKey : public OKey_ADO + { + WpADOKey m_aKey; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + public: + virtual void refreshColumns() override; + public: + OAdoKey(bool _bCase,OConnection* _pConnection,ADOKey* _pKey); + OAdoKey(bool _bCase,OConnection* _pConnection); + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + WpADOKey getImpl() const { return m_aKey;} + // map the update/delete rules + static RuleEnum Map2Rule(sal_Int32 _eNum); + static sal_Int32 MapRule(const RuleEnum& _eNum); + + // map the keytypes + static sal_Int32 MapKeyRule(const KeyTypeEnum& _eNum); + static KeyTypeEnum Map2KeyRule(sal_Int32 _eNum); + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx new file mode 100644 index 000000000..35ef33e37 --- /dev/null +++ b/connectivity/source/inc/ado/AKeys.hxx @@ -0,0 +1,59 @@ +/* -*- 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_ADO_AKEYS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEYS_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OKeys : public sdbcx::OCollection + { + WpADOKeys m_aCollection; + OConnection* m_pConnection; + + protected: + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OKeys(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOKeys& _rCollection, + bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEYS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/APreparedStatement.hxx b/connectivity/source/inc/ado/APreparedStatement.hxx new file mode 100644 index 000000000..214f277c1 --- /dev/null +++ b/connectivity/source/inc/ado/APreparedStatement.hxx @@ -0,0 +1,115 @@ +/* -*- 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_ADO_APREPAREDSTATEMENT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_APREPAREDSTATEMENT_HXX + +#include <ado/AStatement.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/io/XInputStream.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +// TODO: implement css::sdbc::XPreparedBatchExecution +// (empty implementations removed on 2014-06-16) + +namespace connectivity +{ + class OSQLParseNode; + namespace ado + { + + class OPreparedStatement : public OStatement_Base, + public css::sdbc::XPreparedStatement, + public css::sdbc::XParameters, + public css::sdbc::XResultSetMetaDataSupplier, + public css::lang::XServiceInfo + + { + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType, sal_Int32 _nSize,const OLEVariant& Val); + void replaceParameterNodeName( OSQLParseNode const * _pNode, + const OUString& _sDefaultName, + sal_Int32& _nParameterCount); + protected: + + // Data attributes + + css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData; + ADOParameters* m_pParameters; + + virtual ~OPreparedStatement() override; + + public: + DECLARE_SERVICE_INFO(); + // a Constructor, that is needed for when Returning the Object is needed: + OPreparedStatement( OConnection* _pConnection, const OUString& sql); + + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + 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; + + // XPreparedStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; + using OStatement_Base::executeQuery; + virtual sal_Int32 SAL_CALL executeUpdate( ) override; + using OStatement_Base::executeUpdate; + virtual sal_Bool SAL_CALL execute( ) override; + using OStatement_Base::execute; + 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; + // XCloseable + virtual void SAL_CALL close( ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // OComponentHelper + virtual void SAL_CALL disposing() override; + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_APREPAREDSTATEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx new file mode 100644 index 000000000..f90155333 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSet.hxx @@ -0,0 +1,239 @@ +/* -*- 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_ADO_ARESULTSET_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSET_HXX + +#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/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase.hxx> +#include <comphelper/proparrhlp.hxx> +#include <ado/AStatement.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + /* + ** 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::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows, + css::lang::XServiceInfo> OResultSet_BASE; + + class OResultSet : public cppu::BaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + + ADORecordset* m_pRecordSet; + OStatement_Base* m_pStmt; + css::uno::Reference< css::uno::XInterface> m_xStatement; + css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; + std::vector<OLEVariant> m_aBookmarks; + OLEVariant m_aValue; + ADO_LONGPTR m_nRowPos; + bool m_bEOF; + bool m_bOnFirstAfterOpen; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetConcurrency() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetType() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static OUString getCursorName(); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + void updateValue(sal_Int32 columnIndex,const OLEVariant& x); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OLEVariant getValue(sal_Int32 columnIndex ); + + 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 ~OResultSet() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OResultSet( ADORecordset* _pRecordSet,OStatement_Base* pStmt); + OResultSet( ADORecordset* _pRecordSet); + + // late constructor + void construct(); + void setMetaData(const css::uno::Reference< css::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + 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; + + // ::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; + + }; + } + +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSET_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AResultSetMetaData.hxx b/connectivity/source/inc/ado/AResultSetMetaData.hxx new file mode 100644 index 000000000..ebb52be02 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSetMetaData.hxx @@ -0,0 +1,84 @@ +/* -*- 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_ADO_ARESULTSETMETADATA_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSETMETADATA_HXX + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase.hxx> +#include <vector> +#include <ado/Awrapado.hxx> +#include <ado/AResultSet.hxx> +#include <OColumn.hxx> + +namespace connectivity +{ + namespace ado + { + + + //************ Class: ResultSetMetaData + + typedef ::cppu::WeakImplHelper<css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + friend class OResultSet; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + private: + OResultSetMetaData( const OResultSetMetaData& ); // never implemented + OResultSetMetaData& operator=( const OResultSetMetaData& ); // never implemented + + protected: + virtual ~OResultSetMetaData() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OResultSetMetaData( ADORecordset* _pRecordSet); + + 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_ADO_ARESULTSETMETADATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx new file mode 100644 index 000000000..278a35950 --- /dev/null +++ b/connectivity/source/inc/ado/AStatement.hxx @@ -0,0 +1,221 @@ +/* -*- 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_ADO_ASTATEMENT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_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/util/XCancellable.hpp> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <comphelper/proparrhlp.hxx> +#include <ado/AConnection.hxx> +#include <vector> +#include <ado/Awrapado.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, + css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable, + css::sdbc::XMultipleResults> OStatement_BASE; + + + //************ Class: java.sql.Statement + + class OStatement_Base : public cppu::BaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + friend class OResultSet; + + css::sdbc::SQLWarning m_aLastWarning; + + protected: + std::vector< OUString> m_aBatchVector; + + css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + OConnection* m_pConnection;// The owning Connection object + WpADOCommand m_Command; + WpADORecordset m_RecordSet; + OLEVariant m_RecordsAffected; + OLEVariant m_Parameters; + std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ADO_LONGPTR m_nMaxRows; + sal_Int32 m_nFetchSize; + LockTypeEnum m_eLockType; + CursorTypeEnum m_eCursorType; + + using OStatement_BASE::rBHelper; + private: + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getQueryTimeOut() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getMaxFieldSize(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getMaxRows() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetConcurrency() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetType() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString getCursorName() const; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setQueryTimeOut(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setMaxFieldSize(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setMaxRows(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setResultSetConcurrency(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setResultSetType(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setCursorName(const OUString &_par0); + + protected: + + void assignRecordSet( ADORecordset* _pRS ); + + /// @throws css::sdbc::SQLException + void reset (); + /// @throws css::sdbc::SQLException + void clearMyResultSet (); + /// @throws css::sdbc::SQLException + void setWarning (const css::sdbc::SQLWarning &ex); + /// @throws css::sdbc::SQLException + sal_Int32 getRowCount (); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + 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; + public: + OStatement_Base(OConnection* _pConnection ); + + using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + 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; + }; + + class OStatement : public OStatement_Base, + public css::sdbc::XBatchExecution, + public css::lang::XServiceInfo + { + public: + // a Constructor, that is needed for when Returning the Object is needed: + OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){}; + ~OStatement() override; + + DECLARE_SERVICE_INFO(); + + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) 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_ADO_ASTATEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx new file mode 100644 index 000000000..51a9fd145 --- /dev/null +++ b/connectivity/source/inc/ado/ATable.hxx @@ -0,0 +1,77 @@ +/* -*- 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_ADO_ATABLE_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLE_HXX + +#include <connectivity/sdbcx/VTable.hxx> +#include <ado/Awrapadox.hxx> +#include <ado/ACatalog.hxx> + +namespace connectivity +{ + namespace ado + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + typedef connectivity::sdbcx::OTableDescriptor_BASE OTableDescriptor_BASE_TYPEDEF; + + class OAdoTable : public OTable_TYPEDEF + { + WpADOTable m_aTable; + OCatalog* m_pCatalog; + + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + + public: + virtual void refreshColumns() override; + virtual void refreshKeys() override; + virtual void refreshIndexes() override; + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + + public: + OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable); + OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog); + + + virtual OUString SAL_CALL getName() override; + OUString getSchema() const { return m_SchemaName; } + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override; + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + // XRename + virtual void SAL_CALL rename( const OUString& newName ) override; + + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + + WpADOTable getImpl() const { return m_aTable;} + OCatalog* getCatalog() const { return m_pCatalog; } + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx new file mode 100644 index 000000000..a65741862 --- /dev/null +++ b/connectivity/source/inc/ado/ATables.hxx @@ -0,0 +1,57 @@ +/* -*- 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_ADO_ATABLES_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLES_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <ado/Awrapadox.hxx> +#include <ado/ACatalog.hxx> + +namespace connectivity +{ + namespace ado + { + class OCatalog; + class OTables : public sdbcx::OCollection + { + WpADOTables m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOTables& _rCollection, + bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid"); + } + void appendNew(const OUString& _rsNewTable); + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx new file mode 100644 index 000000000..3b7227d36 --- /dev/null +++ b/connectivity/source/inc/ado/AUser.hxx @@ -0,0 +1,91 @@ +/* -*- 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_ADO_AUSER_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSER_HXX + +#include <sdbcx/VUser.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + class OCatalog; + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + typedef connectivity::sdbcx::OUser_BASE OUser_BASE_TYPEDEF; + + class OAdoUser : public OUser_TYPEDEF + { + protected: + WpADOUser m_aUser; + OCatalog* m_pCatalog; + + 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: + virtual void refreshGroups() override; + public: + OAdoUser(OCatalog* _pParent,bool _bCase, ADOUser* _pUser=nullptr); + OAdoUser(OCatalog* _pParent,bool _bCase, const OUString& Name); + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + + WpADOUser getImpl() const { return m_aUser;} + }; + + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OAdoUser, + public OUserExtend_PROP + { + protected: + OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUserExtend(OCatalog* _pParent,bool _bCase,ADOUser* _pUser=nullptr); + OUserExtend(OCatalog* _pParent,bool _bCase,const OUString& Name); + + virtual void construct() override; + OUString getPassword() const { return m_Password;} + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx new file mode 100644 index 000000000..181639196 --- /dev/null +++ b/connectivity/source/inc/ado/AUsers.hxx @@ -0,0 +1,59 @@ +/* -*- 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_ADO_AUSERS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSERS_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <ado/Awrapadox.hxx> +#include <ado/ACatalog.hxx> + +namespace connectivity +{ + namespace ado + { + + class OUsers : public sdbcx::OCollection + { + WpADOUsers m_aCollection; + OCatalog* m_pCatalog; + public: + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual void impl_refresh() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OUsers( OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOUsers& _rCollection, + bool _bCase) + :sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSERS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx new file mode 100644 index 000000000..1bc3dd00b --- /dev/null +++ b/connectivity/source/inc/ado/AView.hxx @@ -0,0 +1,57 @@ +/* -*- 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_ADO_AVIEW_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEW_HXX + +#include <connectivity/sdbcx/VView.hxx> +#include <ado/Awrapadox.hxx> + +namespace connectivity +{ + namespace ado + { + + typedef sdbcx::OView OView_ADO; + + class OAdoView : public OView_ADO + { + WpADOView m_aView; + + protected: + // OPropertySetHelper + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + OAdoView(bool _bCase, ADOView* _pView=nullptr); + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + WpADOView getImpl() const { return m_aView;} + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx new file mode 100644 index 000000000..1ef1a6be3 --- /dev/null +++ b/connectivity/source/inc/ado/AViews.hxx @@ -0,0 +1,56 @@ +/* -*- 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_ADO_AVIEWS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEWS_HXX + +#include <connectivity/sdbcx/VCollection.hxx> +#include <ado/Awrapadox.hxx> +#include <ado/ACatalog.hxx> + + +namespace connectivity +{ + namespace ado + { + + class OViews : public sdbcx::OCollection + { + WpADOViews m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OViews(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + WpADOViews const & _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEWS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx new file mode 100644 index 000000000..732880a7c --- /dev/null +++ b/connectivity/source/inc/ado/Aolevariant.hxx @@ -0,0 +1,154 @@ +/* -*- 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_ADO_AOLEVARIANT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <oaidl.h> + +namespace com +{ + namespace sun + { + namespace star + { + namespace util + { + struct Date; + struct Time; + struct DateTime; + } + } + } +} +namespace connectivity +{ + namespace ado + { + class OLEString + { + BSTR m_sStr; + public: + OLEString(); + OLEString(const BSTR& _sBStr); + OLEString(const OUString& _sBStr); + OLEString(const OLEString& _rRh) + { + OLEString::operator=(_rRh); + } + ~OLEString(); + OLEString& operator=(const OUString& _rSrc); + OLEString& operator=(const BSTR& _rSrc); + OLEString& operator=(const OLEString& _rSrc); + OUString asOUString() const; + BSTR asBSTR() const; + BSTR* getAddress(); + sal_Int32 length() const; + }; + + class OLEVariant : public ::tagVARIANT + { + public: + OLEVariant(); + OLEVariant(const VARIANT& varSrc); + OLEVariant(const OLEVariant& varSrc) ; + OLEVariant(bool x) ; + OLEVariant(sal_Bool) = delete; + OLEVariant(sal_Int8 n) ; + OLEVariant(sal_Int16 n) ; + OLEVariant(sal_Int32 n) ; + OLEVariant(sal_Int64 x) ; + + OLEVariant(const OUString& us) ; + ~OLEVariant() ; + OLEVariant(const css::util::Date& x ); + OLEVariant(const css::util::Time& x ); + OLEVariant(const css::util::DateTime& x ); + OLEVariant(float x); + OLEVariant(const double &x); + OLEVariant(IDispatch* pDispInterface); + OLEVariant(const css::uno::Sequence< sal_Int8 >& x); + OLEVariant& operator=(const OLEVariant& varSrc); + // Assign a const VARIANT& (::VariantCopy handles everything) + + OLEVariant& operator=(const tagVARIANT& varSrc); + // Assign a const VARIANT* (::VariantCopy handles everything) + + OLEVariant& operator=(const VARIANT* pSrc); + void setByte(sal_uInt8 n) ; + void setInt16(sal_Int16 n) ; + void setInt32(sal_Int32 n) ; + void setFloat(float f) ; + void setDouble(double d) ; + void setDate(DATE d) ; + void setChar(unsigned char a) ; + void setCurrency(double aCur) ; + void setBool(bool b) ; + void setString(const OUString& us) ; + void setNoArg() ; + + void setIDispatch(IDispatch* pDispInterface); + void setNull() ; + void setEmpty() ; + + void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr); + void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType); + bool isNull() const ; + bool isEmpty() const ; + + VARTYPE getType() const ; + void ChangeType(VARTYPE vartype, const OLEVariant* pSrc); + + OUString getString() const; + bool getBool() const; + IUnknown* getIUnknown() const; + IDispatch* getIDispatch() const; + sal_uInt8 getByte() const; + sal_Int16 getInt16() const; + sal_Int8 getInt8() const; + sal_Int32 getInt32() const; + sal_uInt32 getUInt32() const; + float getFloat() const; + double getDouble() const; + double getDateAsDouble() const; + CY getCurrency() const; + css::util::Date getDate() const; + css::util::Time getTime() const; + css::util::DateTime getDateTime() const; + css::uno::Sequence<sal_Int8> getByteSequence() const; + SAFEARRAY* getUI1SAFEARRAYPtr() const; + css::uno::Any makeAny() const; + + static VARIANT_BOOL VariantBool(bool bEinBoolean); + + private: + void CHS(); + + void set(double n); + + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx new file mode 100644 index 000000000..ef5c1a859 --- /dev/null +++ b/connectivity/source/inc/ado/Aolewrap.hxx @@ -0,0 +1,225 @@ +/* -*- 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_ADO_AOLEWRAP_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEWRAP_HXX + +#include <osl/diagnose.h> +#include <osl/thread.h> +#include <map> +#include <vector> + +namespace rtl +{ + class OUString; +} +namespace connectivity +{ + namespace ado + { + class OLEVariant; + class WpBase + { + protected: + IDispatch* pIUnknown; + + void setIDispatch(IDispatch* _pIUnknown); + public: + WpBase(); + WpBase(IDispatch* pInt); + //inline + WpBase& operator=(const WpBase& rhs); + WpBase& operator=(IDispatch* rhs); + WpBase(const WpBase& aWrapper); + virtual ~WpBase(); + void clear(); + + + bool IsValid() const; + operator IDispatch*(); + + }; + + // Template class WpOLEBase<class T> + // ================================== + // + // Objects of this class contain a pointer to an interface of the type T. + // The ctors and operator= make sure, that AddRef() and Release() are being + // called adhering to COM conventions. + // An object can also hold no pointer (null pointer), calling IsValid() then + // returns false. + // + // In order to do efficient pass-by-value, this class (as all derived classes) + // is a thin wrapper class, avoiding virtual methods and inlining. + + template<class T> class WpOLEBase : public WpBase + { + protected: + T* pInterface; + + public: + WpOLEBase(T* pInt = nullptr) : WpBase(pInt),pInterface(pInt){} + + + //inline + WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs) + { + WpBase::operator=(rhs); + pInterface = rhs.pInterface; + return *this; + }; + + WpOLEBase<T>& operator=(T* rhs) + { + WpBase::operator=(rhs); + pInterface = rhs.pInterface; + return *this; + } + + WpOLEBase(const WpOLEBase<T>& aWrapper) + : WpBase( aWrapper ) + , pInterface( aWrapper.pInterface ) + { + } + + operator T*() const { return pInterface; } + void setWithOutAddRef(T* _pInterface) + { + pInterface = _pInterface; + WpBase::setIDispatch(_pInterface); + } + }; + + + // Template class WpOLECollection<class Ts, class T, class WrapT> + // =============================================================== + // + // This class (derived from WpOLEBase<Ts>), abstracts away the properties + // common to DAO collections: + // + // They are accessed via an interface Ts (e.g. DAOFields) and can return + // Items of the Type T (actually: with the interface T, e.g. DAOField) + // via get_Item (here GetItem). + // + // This wrapper class does not expose an interface T, however, + // it exposes an object of the class WrapT. This must allow a construction + // by T, preferably it is derived from WpOLEBase<T>. + + template<class Ts, class T, class WrapT> class WpOLECollection : public WpOLEBase<Ts> + { + public: + using WpOLEBase<Ts>::pInterface; + using WpOLEBase<Ts>::IsValid; + // Ctors, operator= + // They only call the superclass + WpOLECollection(Ts* pInt=nullptr):WpOLEBase<Ts>(pInt){} + WpOLECollection(const WpOLECollection& rhs) : WpOLEBase<Ts>(rhs) {} + WpOLECollection& operator=(const WpOLECollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + + + void Refresh(){pInterface->Refresh();} + + sal_Int32 GetItemCount() const + { + sal_Int32 nCount = 0; + return pInterface ? (SUCCEEDED(pInterface->get_Count(&nCount)) ? nCount : sal_Int32(0)) : sal_Int32(0); + } + + WrapT GetItem(sal_Int32 index) const + { + OSL_ENSURE(index >= 0 && index<GetItemCount(),"Wrong index for field!"); + T* pT = NULL; + WrapT aRet(NULL); + if(SUCCEEDED(pInterface->get_Item(OLEVariant(index), &pT))) + aRet.setWithOutAddRef(pT); + return aRet; + } + + WrapT GetItem(const OLEVariant& index) const + { + T* pT = NULL; + WrapT aRet(NULL); + if(SUCCEEDED(pInterface->get_Item(index, &pT))) + aRet.setWithOutAddRef(pT); + return aRet; + } + + WrapT GetItem(const OUString& sStr) const + { + WrapT aRet(NULL); + T* pT = NULL; + if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT))) + { +#if OSL_DEBUG_LEVEL > 0 + OString sTemp("Unknown Item: " + OString(sStr.getStr(),sStr.getLength(),osl_getThreadTextEncoding())); + OSL_FAIL(sTemp.getStr()); +#endif + } + else + aRet.setWithOutAddRef(pT); + return aRet; + } + void fillElementNames(::std::vector< OUString>& _rVector) + { + if(IsValid()) + { + Refresh(); + sal_Int32 nCount = GetItemCount(); + _rVector.reserve(nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + WrapT aElement = GetItem(i); + if(aElement.IsValid()) + _rVector.push_back(aElement.get_Name()); + } + } + } + }; + + template<class Ts, class T, class WrapT> class WpOLEAppendCollection: + public WpOLECollection<Ts,T,WrapT> + { + + public: + // Ctors, operator= + // They only call the superclass + using WpOLEBase<Ts>::pInterface; + WpOLEAppendCollection(Ts* pInt=nullptr):WpOLECollection<Ts,T,WrapT>(pInt){} + WpOLEAppendCollection(const WpOLEAppendCollection& rhs) : WpOLECollection<Ts, T, WrapT>(rhs) {} + WpOLEAppendCollection& operator=(const WpOLEAppendCollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + + + bool Append(const WrapT& aWrapT) + { + return SUCCEEDED(pInterface->Append(OLEVariant(static_cast<T*>(aWrapT)))); + }; + + bool Delete(const OUString& sName) + { + return SUCCEEDED(pInterface->Delete(OLEVariant(sName))); + }; + + + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEWRAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx new file mode 100644 index 000000000..c7817a75b --- /dev/null +++ b/connectivity/source/inc/ado/Awrapado.hxx @@ -0,0 +1,376 @@ +/* -*- 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_ADO_AWRAPADO_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX + +#include <com/sun/star/beans/PropertyAttribute.hpp> + +// Includes for ADO +#include <oledb.h> +#include <ocidl.h> +#include <adoint.h> +#include <ado/adoimp.hxx> +#include <ado/Aolewrap.hxx> +#include <ado/Aolevariant.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + class WpADOCommand; + class WpADORecordset; + class WpADOField; + class WpADOParameter; + class WpADOError; + class WpADOProperty; + + typedef WpOLEAppendCollection< ADOFields, ADOField, WpADOField> WpADOFields; + typedef WpOLECollection< ADOProperties, ADOProperty, WpADOProperty> WpADOProperties; + + + class WpADOConnection : public WpOLEBase<ADOConnection> + { + friend class WpADOCommand; + public: + + WpADOConnection(ADOConnection* pInt) : WpOLEBase<ADOConnection>(pInt){} + + WpADOConnection(const WpADOConnection& rhs) : WpOLEBase<ADOConnection>(rhs) {} + + WpADOConnection& operator=(const WpADOConnection& rhs) + {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} + + + WpADOProperties get_Properties() const; + + OUString GetConnectionString() const; + bool PutConnectionString(const OUString &aCon) const; + sal_Int32 GetCommandTimeout() const; + void PutCommandTimeout(sal_Int32 nRet); + sal_Int32 GetConnectionTimeout() const ; + void PutConnectionTimeout(sal_Int32 nRet); + + bool Close( ) ; + bool Execute(const OUString& CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset); + bool BeginTrans(); + bool CommitTrans( ) ; + bool RollbackTrans( ); + bool Open(const OUString& ConnectionString, const OUString& UserID,const OUString& Password,long Options); + bool GetErrors(ADOErrors** pErrors); + + OUString GetDefaultDatabase() const; + bool PutDefaultDatabase(const OUString& _bstr); + + IsolationLevelEnum get_IsolationLevel() const ; + bool put_IsolationLevel(const IsolationLevelEnum& eNum) ; + + sal_Int32 get_Attributes() const; + bool put_Attributes(sal_Int32 nRet); + + CursorLocationEnum get_CursorLocation() const; + bool put_CursorLocation(const CursorLocationEnum &eNum) ; + + ConnectModeEnum get_Mode() const; + bool put_Mode(const ConnectModeEnum &eNum) ; + + OUString get_Provider() const; + bool put_Provider(const OUString& _bstr); + + sal_Int32 get_State() const; + + bool OpenSchema(SchemaEnum eNum,OLEVariant const & Restrictions,OLEVariant const & SchemaID,ADORecordset**pprset); + + OUString get_Version() const; + + // special methods + ADORecordset* getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ); + ADORecordset* getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ); + ADORecordset* getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ); + ADORecordset* getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, bool unique, bool approximate ); + ADORecordset* getTablePrivileges( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& tableNamePattern ); + ADORecordset* getCrossReference( const css::uno::Any& primaryCatalog, + const OUString& primarySchema, + const OUString& primaryTable, + const css::uno::Any& foreignCatalog, + const OUString& foreignSchema, + const OUString& foreignTable); + ADORecordset* getProcedures( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& procedureNamePattern ); + ADORecordset* getProcedureColumns( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& procedureNamePattern, + const OUString& columnNamePattern ); + ADORecordset* getTables( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& tableNamePattern, + const css::uno::Sequence< OUString >& types ); + ADORecordset* getColumns( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& tableNamePattern, + const OUString& columnNamePattern ); + ADORecordset* getColumnPrivileges( const css::uno::Any& catalog, + const OUString& schemaPattern, + const OUString& table, + const OUString& columnNamePattern ); + ADORecordset* getTypeInfo(DataTypeEnum _eType = adEmpty ); + }; + + + class WpADOCommand : public WpOLEBase<ADOCommand> + { + public: + WpADOCommand(){} + // Ctors, operator= + // They only call the superclass + WpADOCommand(ADOCommand* pInt) : WpOLEBase<ADOCommand>(pInt){} + + WpADOCommand(const WpADOCommand& rhs) : WpOLEBase<ADOCommand>(rhs) {} + + WpADOCommand& operator=(const WpADOCommand& rhs) + { + WpOLEBase<ADOCommand>::operator=(rhs); return *this;} + + + bool putref_ActiveConnection( WpADOConnection *pCon); + + void put_ActiveConnection(/* [in] */ const OLEVariant& vConn); + void Create(); + sal_Int32 get_State() const; + OUString get_CommandText() const; + bool put_CommandText(const OUString &aCon) ; + sal_Int32 get_CommandTimeout() const; + void put_CommandTimeout(sal_Int32 nRet); + bool get_Prepared() const; + bool put_Prepared(VARIANT_BOOL bPrepared) const; + bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset); + ADOParameter* CreateParameter(const OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value); + + ADOParameters* get_Parameters() const; + bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType); + CommandTypeEnum get_CommandType( ) const ; + // Returns the field's name + OUString GetName() const ; + bool put_Name(const OUString& Name); + bool Cancel(); + }; + + class WpADOError : public WpOLEBase<ADOError> + { + public: + + // Ctors, operator= + // They only call the superclass + WpADOError(ADOError* pInt):WpOLEBase<ADOError>(pInt){} + + WpADOError(const WpADOError& rhs) : WpOLEBase<ADOError>(rhs) {} + + WpADOError& operator=(const WpADOError& rhs) + {WpOLEBase<ADOError>::operator=(rhs); return *this;} + + + OUString GetDescription() const; + OUString GetSource() const ; + sal_Int32 GetNumber() const ; + OUString GetSQLState() const ; + sal_Int32 GetNativeError() const ; + }; + + + class WpADOField : public WpOLEBase<ADOField> + { + // friend class WpADOFields; + public: + + // Ctors, operator= + // They only call the superclass + WpADOField(ADOField* pInt=nullptr):WpOLEBase<ADOField>(pInt){} + WpADOField(const WpADOField& rhs) : WpOLEBase<ADOField>(rhs) {} + + WpADOField& operator=(const WpADOField& rhs) + {WpOLEBase<ADOField>::operator=(rhs); return *this;} + + + WpADOProperties get_Properties(); + sal_Int32 GetActualSize() const ; + sal_Int32 GetAttributes() const ; + sal_Int32 GetStatus() const ; + sal_Int32 GetDefinedSize() const ; + // Returns the field's name + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void get_Value(OLEVariant& aValVar) const ; + OLEVariant get_Value() const; + bool PutValue(const OLEVariant& aVariant); + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + bool AppendChunk(const OLEVariant& Variant); + OLEVariant GetChunk(long Length) const; + void GetChunk(long Length,OLEVariant &aValVar) const; + OLEVariant GetOriginalValue() const; + void GetOriginalValue(OLEVariant &aValVar) const; + OLEVariant GetUnderlyingValue() const; + + void GetUnderlyingValue(OLEVariant &aValVar) const; + + bool PutPrecision(sal_Int8 _prec); + + bool PutNumericScale(sal_Int8 _prec); + + void PutADOType(DataTypeEnum eType) ; + + bool PutDefinedSize(sal_Int32 _nDefSize); + + bool PutAttributes(sal_Int32 _nDefSize); + }; + + + class WpADOProperty: public WpOLEBase<ADOProperty> + { + public: + // Ctors, operator= + // They only call the superclass + WpADOProperty(ADOProperty* pInt=nullptr):WpOLEBase<ADOProperty>(pInt){} + WpADOProperty(const WpADOProperty& rhs) : WpOLEBase<ADOProperty>(rhs) {} + WpADOProperty& operator=(const WpADOProperty& rhs) + {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} + + + OLEVariant GetValue() const; + void GetValue(OLEVariant &aValVar) const; + bool PutValue(const OLEVariant &aValVar) ; + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + sal_Int32 GetAttributes() const ; + bool PutAttributes(sal_Int32 _nDefSize); + }; + + + class WpADORecordset : public WpOLEBase<ADORecordset> + { + + public: + // Ctors, operator= + // They only call the superclass + WpADORecordset(ADORecordset* pInt=nullptr):WpOLEBase<ADORecordset>(pInt){} + WpADORecordset(const WpADORecordset& rhs) : WpOLEBase<ADORecordset>() {operator=(rhs);} + WpADORecordset& operator=(const WpADORecordset& rhs) + { + WpOLEBase<ADORecordset>::operator=(rhs); + return *this; + } + + void Create(); + bool Open( + /* [optional][in] */ VARIANT Source, + /* [optional][in] */ VARIANT ActiveConnection, + /* [defaultvalue][in] */ CursorTypeEnum CursorType, + /* [defaultvalue][in] */ LockTypeEnum LockType, + /* [defaultvalue][in] */ sal_Int32 Options); + LockTypeEnum GetLockType(); + void Close(); + bool Cancel() const; + sal_Int32 get_State( ); + bool Supports( /* [in] */ CursorOptionEnum CursorOptions); + PositionEnum_Param get_AbsolutePosition(); + void GetDataSource(IUnknown** pIUnknown) const ; + void PutRefDataSource(IUnknown* pIUnknown); + void GetBookmark(VARIANT& var); + OLEVariant GetBookmark(); + CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right); + bool SetBookmark(const OLEVariant &pSafeAr); + WpADOFields GetFields() const; + bool Move(sal_Int32 nRows, VARIANT aBmk); + bool MoveNext(); + bool MovePrevious(); + bool MoveFirst(); + bool MoveLast(); + + bool IsAtBOF() const; + bool IsAtEOF() const; + bool Delete(AffectEnum eNum); + bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values); + bool Update(const OLEVariant &FieldList,const OLEVariant &Values); + bool CancelUpdate(); + WpADOProperties get_Properties() const; + bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); + bool get_RecordCount(ADO_LONGPTR &_nRet) const; + bool get_MaxRecords(ADO_LONGPTR &_nRet) const; + bool put_MaxRecords(ADO_LONGPTR _nRet); + bool get_CursorType(CursorTypeEnum &_nRet) const; + bool put_CursorType(CursorTypeEnum _nRet); + bool get_LockType(LockTypeEnum &_nRet) const; + bool put_LockType(LockTypeEnum _nRet); + bool get_CacheSize(sal_Int32 &_nRet) const; + bool put_CacheSize(sal_Int32 _nRet); + bool UpdateBatch(AffectEnum AffectRecords); + }; + + + class WpADOParameter:public WpOLEBase<ADOParameter> + { + public: + // Ctors, operator= + // They only call the superclass + WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){} + WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} + WpADOParameter& operator=(const WpADOParameter& rhs) + {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} + + + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void put_Type(const DataTypeEnum& _eType); + bool put_Size(sal_Int32 _nSize); + sal_Int32 GetAttributes() const ; + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + ParameterDirectionEnum get_Direction() const; + void GetValue(OLEVariant& aValVar) const ; + OLEVariant GetValue() const; + bool PutValue(const OLEVariant& aVariant); + bool AppendChunk(const OLEVariant& aVariant); + }; + + class OTools + { + public: + /** putValue set the property value at the ado column + @param _rProps the properties where to set + @param _aPosition which property to set + @param _aValVar the value to set + */ + static void putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar); + + /** getValue returns a specific property value + @param _rProps the properties where to set + @param _aPosition the property + + @return the property value + */ + static OLEVariant getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition); + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Awrapadox.hxx b/connectivity/source/inc/ado/Awrapadox.hxx new file mode 100644 index 000000000..7a4f3e5a1 --- /dev/null +++ b/connectivity/source/inc/ado/Awrapadox.hxx @@ -0,0 +1,138 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/beans/PropertyAttribute.hpp> + +#ifndef __User_FWD_DEFINED__ +#define __User_FWD_DEFINED__ +typedef struct _ADOUser User; +#endif + +#ifndef __Group_FWD_DEFINED__ +#define __Group_FWD_DEFINED__ +typedef struct _ADOGroup Group; +#endif + +#ifndef __Column_FWD_DEFINED__ +#define __Column_FWD_DEFINED__ +typedef struct _ADOColumn Column; +#endif + +#ifndef __Index_FWD_DEFINED__ +#define __Index_FWD_DEFINED__ +typedef struct _ADOIndex Index; +#endif + +#ifndef __Key_FWD_DEFINED__ +#define __Key_FWD_DEFINED__ +typedef struct _ADOKey Key; +#endif + +#ifndef __Table_FWD_DEFINED__ +#define __Table_FWD_DEFINED__ +typedef struct _ADOTable Table; +#endif + + +#include <adoint.h> +#include <adoctint.h> + + +#include <ado/Aolewrap.hxx> +#include <ado/Aolevariant.hxx> +#include <ado/adoimp.hxx> +#include <ado/Awrapado.hxx> +#include <ado/WrapColumn.hxx> +#include <ado/WrapIndex.hxx> +#include <ado/WrapKey.hxx> +#include <ado/WrapTable.hxx> +#include <ado/WrapCatalog.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOView : public WpOLEBase<ADOView> + { + public: + WpADOView(ADOView* pInt=nullptr) : WpOLEBase<ADOView>(pInt){} + WpADOView(const WpADOView& rhs) : WpOLEBase<ADOView>(rhs) {} + + WpADOView& operator=(const WpADOView& rhs) + {WpOLEBase<ADOView>::operator=(rhs); return *this;} + + OUString get_Name() const; + void get_Command(OLEVariant& _rVar) const; + void put_Command(OLEVariant const & _rVar); + }; + + class WpADOGroup : public WpOLEBase<ADOGroup> + { + public: + WpADOGroup(ADOGroup* pInt=nullptr) : WpOLEBase<ADOGroup>(pInt){} + WpADOGroup(const WpADOGroup& rhs) : WpOLEBase<ADOGroup>(rhs) {} + + WpADOGroup& operator=(const WpADOGroup& rhs) + {WpOLEBase<ADOGroup>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(const OUString& _rName); + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType); + bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights); + WpADOUsers get_Users( ); + }; + + class WpADOUser : public WpOLEBase<_ADOUser> + { + public: + WpADOUser(_ADOUser* pInt=nullptr) : WpOLEBase<_ADOUser>(pInt){} + WpADOUser(const WpADOUser& rhs) : WpOLEBase<_ADOUser>(rhs) {} + + WpADOUser& operator=(const WpADOUser& rhs) + {WpOLEBase<_ADOUser>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(const OUString& _rName); + bool ChangePassword(const OUString& _rPwd,const OUString& _rNewPwd); + WpADOGroups get_Groups(); + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType); + bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights); + }; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapCatalog.hxx b/connectivity/source/inc/ado/WrapCatalog.hxx new file mode 100644 index 000000000..3587d5bcd --- /dev/null +++ b/connectivity/source/inc/ado/WrapCatalog.hxx @@ -0,0 +1,52 @@ +/* -*- 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_ADO_WRAPCATALOG_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCATALOG_HXX + +#include <ado/WrapTypeDefs.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOCatalog : public WpOLEBase<_ADOCatalog> + { + public: + WpADOCatalog(_ADOCatalog* pInt = nullptr) : WpOLEBase<_ADOCatalog>(pInt){} + WpADOCatalog(const WpADOCatalog& rhs) : WpOLEBase<_ADOCatalog>(rhs) {} + + WpADOCatalog& operator=(const WpADOCatalog& rhs) + {WpOLEBase<_ADOCatalog>::operator=(rhs); return *this;} + + OUString GetObjectOwner(const OUString& _rName, ObjectTypeEnum _eNum); + + void putref_ActiveConnection(IDispatch* pCon); + WpADOTables get_Tables(); + WpADOViews get_Views(); + WpADOGroups get_Groups(); + WpADOUsers get_Users(); + ADOProcedures* get_Procedures(); + void Create(); + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCATALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapColumn.hxx b/connectivity/source/inc/ado/WrapColumn.hxx new file mode 100644 index 000000000..7f3dd3d86 --- /dev/null +++ b/connectivity/source/inc/ado/WrapColumn.hxx @@ -0,0 +1,64 @@ +/* -*- 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_ADO_WRAPCOLUMN_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCOLUMN_HXX + +#include <ado/Aolewrap.hxx> + +#include <adoint.h> + +namespace connectivity +{ + namespace ado + { + class WpADOColumn : public WpOLEBase<_ADOColumn> + { + public: + WpADOColumn(_ADOColumn* pInt=nullptr) : WpOLEBase<_ADOColumn>(pInt){} + WpADOColumn(const WpADOColumn& rhs) : WpOLEBase<_ADOColumn>(rhs) {} + + void Create(); + + WpADOColumn& operator=(const WpADOColumn& rhs) + {WpOLEBase<_ADOColumn>::operator=(rhs); return *this;} + + OUString get_Name() const; + OUString get_RelatedColumn() const; + void put_Name(const OUString& _rName); + void put_RelatedColumn(const OUString& _rName); + DataTypeEnum get_Type() const; + void put_Type(const DataTypeEnum& _eNum) ; + sal_Int32 get_Precision() const; + void put_Precision(sal_Int32 _nPre) ; + sal_uInt8 get_NumericScale() const; + void put_NumericScale(sal_Int8 _nScale); + SortOrderEnum get_SortOrder() const; + void put_SortOrder(SortOrderEnum _nScale); + sal_Int32 get_DefinedSize() const; + ColumnAttributesEnum get_Attributes() const; + bool put_Attributes(const ColumnAttributesEnum& _eNum); + WpADOProperties get_Properties() const; + void put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCOLUMN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapIndex.hxx b/connectivity/source/inc/ado/WrapIndex.hxx new file mode 100644 index 000000000..e60a1249a --- /dev/null +++ b/connectivity/source/inc/ado/WrapIndex.hxx @@ -0,0 +1,54 @@ +/* -*- 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_ADO_WRAPINDEX_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPINDEX_HXX + +#include <ado/WrapTypeDefs.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOIndex : public WpOLEBase<_ADOIndex> + { + public: + WpADOIndex(_ADOIndex* pInt=nullptr) : WpOLEBase<_ADOIndex>(pInt){} + WpADOIndex(const WpADOIndex& rhs) : WpOLEBase<_ADOIndex>(rhs) {} + + WpADOIndex& operator=(const WpADOIndex& rhs) + {WpOLEBase<_ADOIndex>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(const OUString& _rName); + bool get_Clustered() const; + void put_Clustered(bool _b); + bool get_Unique() const; + void put_Unique(bool _b); + bool get_PrimaryKey() const; + void put_PrimaryKey(bool _b); + WpADOColumns get_Columns() const; + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPINDEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapKey.hxx b/connectivity/source/inc/ado/WrapKey.hxx new file mode 100644 index 000000000..e5e10a56c --- /dev/null +++ b/connectivity/source/inc/ado/WrapKey.hxx @@ -0,0 +1,56 @@ +/* -*- 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_ADO_WRAPKEY_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPKEY_HXX + +#include <ado/WrapTypeDefs.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOKey : public WpOLEBase<ADOKey> + { + public: + WpADOKey(ADOKey* pInt=nullptr) : WpOLEBase<ADOKey>(pInt){} + WpADOKey(const WpADOKey& rhs) : WpOLEBase<ADOKey>(rhs) {} + + WpADOKey& operator=(const WpADOKey& rhs) + {WpOLEBase<ADOKey>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(const OUString& _rName); + KeyTypeEnum get_Type() const; + void put_Type(const KeyTypeEnum& _eNum) ; + OUString get_RelatedTable() const; + void put_RelatedTable(const OUString& _rName); + RuleEnum get_DeleteRule() const; + void put_DeleteRule(const RuleEnum& _eNum) ; + RuleEnum get_UpdateRule() const; + void put_UpdateRule(const RuleEnum& _eNum) ; + WpADOColumns get_Columns() const; + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPKEY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapTable.hxx b/connectivity/source/inc/ado/WrapTable.hxx new file mode 100644 index 000000000..b7a1be72e --- /dev/null +++ b/connectivity/source/inc/ado/WrapTable.hxx @@ -0,0 +1,59 @@ +/* -*- 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_ADO_WRAPTABLE_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTABLE_HXX + +#include <ado/WrapTypeDefs.hxx> + +namespace connectivity +{ + namespace ado + { + class WpADOCatalog; + + class WpADOTable : public WpOLEBase<_ADOTable> + { + public: + WpADOTable(_ADOTable* pInt=nullptr) : WpOLEBase<_ADOTable>(pInt){} + WpADOTable(const WpADOTable& rhs) : WpOLEBase<_ADOTable>(rhs) {} + + WpADOTable& operator=(const WpADOTable& rhs) + {WpOLEBase<_ADOTable>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(const OUString& _rName); + OUString get_Type() const; + WpADOColumns get_Columns() const; + WpADOIndexes get_Indexes() const; + WpADOKeys get_Keys() const; + WpADOCatalog get_ParentCatalog() const; + WpADOProperties get_Properties() const; + void putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; + + + typedef WpOLEAppendCollection<ADOTables, _ADOTable, WpADOTable> WpADOTables; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapTypeDefs.hxx b/connectivity/source/inc/ado/WrapTypeDefs.hxx new file mode 100644 index 000000000..1a76dc5f8 --- /dev/null +++ b/connectivity/source/inc/ado/WrapTypeDefs.hxx @@ -0,0 +1,47 @@ +/* -*- 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_ADO_WRAPTYPEDEFS_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTYPEDEFS_HXX + + +namespace connectivity +{ + namespace ado + { + class WpADOTable; + class WpADOKey; + class WpADOIndex; + class WpADOColumn; + class WpADOGroup; + class WpADOView; + class WpADOUser; + + typedef WpOLEAppendCollection<ADOTables, _ADOTable, WpADOTable> WpADOTables; + typedef WpOLEAppendCollection<ADOKeys, ADOKey, WpADOKey> WpADOKeys; + typedef WpOLEAppendCollection<ADOIndexes, _ADOIndex, WpADOIndex> WpADOIndexes; + typedef WpOLEAppendCollection<ADOColumns, _ADOColumn, WpADOColumn> WpADOColumns; + typedef WpOLEAppendCollection<ADOGroups, ADOGroup, WpADOGroup> WpADOGroups; + typedef WpOLEAppendCollection<ADOViews, ADOView, WpADOView> WpADOViews; + typedef WpOLEAppendCollection<ADOUsers, _ADOUser, WpADOUser> WpADOUsers; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTYPEDEFS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx new file mode 100644 index 000000000..8393ca731 --- /dev/null +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -0,0 +1,106 @@ +/* -*- 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_ADO_ADOIMP_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADOIMP_HXX + +#include <com/sun/star/sdbc/SQLException.hpp> + +#include <adoctint.h> + +struct ADOConnection; +namespace connectivity +{ + namespace ado + { + + class WpADOField; + class OLEString; + class ADOS + { + public: + // Also here: Free BSTR with SysFreeString()! + static OLEString& GetKeyStr(); + + static const CLSID CLSID_ADOCATALOG_25; + static const IID IID_ADOCATALOG_25; + + static const CLSID CLSID_ADOCONNECTION_21; + static const IID IID_ADOCONNECTION_21; + + static const CLSID CLSID_ADOCOMMAND_21; + static const IID IID_ADOCOMMAND_21; + + static const CLSID CLSID_ADORECORDSET_21; + static const IID IID_ADORECORDSET_21; + + static const CLSID CLSID_ADOINDEX_25; + static const IID IID_ADOINDEX_25; + + static const CLSID CLSID_ADOCOLUMN_25; + static const IID IID_ADOCOLUMN_25; + + static const CLSID CLSID_ADOKEY_25; + static const IID IID_ADOKEY_25; + + static const CLSID CLSID_ADOTABLE_25; + static const IID IID_ADOTABLE_25; + + static const CLSID CLSID_ADOGROUP_25; + static const IID IID_ADOGROUP_25; + + static const CLSID CLSID_ADOUSER_25; + static const IID IID_ADOUSER_25; + + static const CLSID CLSID_ADOVIEW_25; + static const IID IID_ADOVIEW_25; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static void ThrowException(ADOConnection* _pAdoCon,const css::uno::Reference< css::uno::XInterface >& _xInterface); + static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine); + static bool isJetEngine(sal_Int32 _nEngineType); + + static ObjectTypeEnum mapObjectType2Ado(sal_Int32 objType); + static sal_Int32 mapAdoType2Object(ObjectTypeEnum objType); + static sal_Int32 mapAdoRights2Sdbc(RightsEnum eRights); + static sal_Int32 mapRights2Ado(sal_Int32 nRights); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static WpADOField getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex); + }; + + + } +} + +#define ADO_PROP(ItemName) \ + WpADOProperty aProp(aProps.GetItem(ItemName)); \ + OLEVariant aVar; \ + if(aProp.IsValid()) \ + aVar = aProp.GetValue(); \ + else \ + ADOS::ThrowException(*m_pADOConnection,*this); + + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADOIMP_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |