1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10*2e2212a7SAndrew Rist * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2e2212a7SAndrew Rist * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19*2e2212a7SAndrew Rist * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DBA_COREAPI_QUERY_HXX_ 25cdf0e10cSrcweir #define _DBA_COREAPI_QUERY_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ 28cdf0e10cSrcweir #include "querydescriptor.hxx" 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE3_HXX_ 31cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ 34cdf0e10cSrcweir #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_ 37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 40cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ 43cdf0e10cSrcweir #include <com/sun/star/sdbcx/XRename.hpp> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #ifndef DBA_CONTENTHELPER_HXX 46cdf0e10cSrcweir #include "ContentHelper.hxx" 47cdf0e10cSrcweir #endif 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include <map> 50cdf0e10cSrcweir 51cdf0e10cSrcweir namespace dbtools 52cdf0e10cSrcweir { 53cdf0e10cSrcweir class IWarningsContainer; 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir //........................................................................ 57cdf0e10cSrcweir namespace dbaccess 58cdf0e10cSrcweir { 59cdf0e10cSrcweir //........................................................................ 60cdf0e10cSrcweir 61cdf0e10cSrcweir //========================================================================== 62cdf0e10cSrcweir //= OQuery - an object implementing the sdb.Query service 63cdf0e10cSrcweir //========================================================================== 64cdf0e10cSrcweir typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbcx::XDataDescriptorFactory, 65cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener, 66cdf0e10cSrcweir ::com::sun::star::sdbcx::XRename 67cdf0e10cSrcweir > OQuery_Base; 68cdf0e10cSrcweir class OQuery; 69cdf0e10cSrcweir class OColumn; 70cdf0e10cSrcweir typedef ::comphelper::OPropertyArrayUsageHelper< OQuery > OQuery_ArrayHelperBase; 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir class OQuery :public OContentHelper 74cdf0e10cSrcweir ,public OQueryDescriptor_Base 75cdf0e10cSrcweir ,public OQuery_Base 76cdf0e10cSrcweir ,public OQuery_ArrayHelperBase 77cdf0e10cSrcweir ,public ODataSettings 78cdf0e10cSrcweir { 79cdf0e10cSrcweir friend struct TRelease; 80cdf0e10cSrcweir 81cdf0e10cSrcweir public: 82cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString,OColumn*,::comphelper::UStringMixLess> TNameColumnMap; 83cdf0e10cSrcweir 84cdf0e10cSrcweir protected: 85cdf0e10cSrcweir // TNameColumnMap m_aColumnMap; // contains all columnnames to columns 86cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCommandDefinition; 87cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; 88cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xCommandPropInfo; 89cdf0e10cSrcweir ::rtl::Reference< OContainerMediator > m_pColumnMediator; 90cdf0e10cSrcweir ::dbtools::IWarningsContainer* m_pWarnings; 91cdf0e10cSrcweir sal_Bool m_bCaseSensitiv : 1; // assume case sensitivity of the column names ? 92cdf0e10cSrcweir 93cdf0e10cSrcweir // possible actions on our "aggregate" 94cdf0e10cSrcweir enum AGGREGATE_ACTION { NONE, SETTING_PROPERTIES, FLUSHING }; 95cdf0e10cSrcweir AGGREGATE_ACTION m_eDoingCurrently; 96cdf0e10cSrcweir 97cdf0e10cSrcweir // ------------------------------------------------------------------------ 98cdf0e10cSrcweir /** a class which automatically resets m_eDoingCurrently in it's destructor 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir class OAutoActionReset; // just for the following friend declaration 101cdf0e10cSrcweir friend class OAutoActionReset; 102cdf0e10cSrcweir class OAutoActionReset 103cdf0e10cSrcweir { 104cdf0e10cSrcweir OQuery* m_pActor; 105cdf0e10cSrcweir public: OAutoActionReset(OQuery * _pActor)106cdf0e10cSrcweir OAutoActionReset(OQuery* _pActor) : m_pActor(_pActor) { } ~OAutoActionReset()107cdf0e10cSrcweir ~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; } 108cdf0e10cSrcweir }; 109cdf0e10cSrcweir 110cdf0e10cSrcweir protected: 111cdf0e10cSrcweir virtual ~OQuery(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // OPropertyArrayUsageHelper 114cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; getArrayHelper()115cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* getArrayHelper() { return OQuery_ArrayHelperBase::getArrayHelper(); } 116cdf0e10cSrcweir 117cdf0e10cSrcweir public: 118cdf0e10cSrcweir OQuery( 119cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxCommandDefinition, 120cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, 121cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB 122cdf0e10cSrcweir ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir // com::sun::star::lang::XTypeProvider 125cdf0e10cSrcweir DECLARE_TYPEPROVIDER( ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir // ::com::sun::star::uno::XInterface 128cdf0e10cSrcweir DECLARE_XINTERFACE( ) 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ::com::sun::star::beans::XPropertySet 131cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir 133cdf0e10cSrcweir // OPropertySetHelper 134cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 135cdf0e10cSrcweir 136cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 137cdf0e10cSrcweir DECLARE_SERVICE_INFO(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir // ::com::sun::star::sdbcx::XDataDescriptorFactory 140cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir 142cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyChangeListener 143cdf0e10cSrcweir virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); 144cdf0e10cSrcweir 145cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener 146cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); 147cdf0e10cSrcweir 148cdf0e10cSrcweir // OPropertySetHelper 149cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( 150cdf0e10cSrcweir sal_Int32 nHandle, 151cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue ) 152cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 153cdf0e10cSrcweir 154cdf0e10cSrcweir public: 155cdf0e10cSrcweir // the caller is responsible for the lifetime! setWarningsContainer(::dbtools::IWarningsContainer * _pWarnings)156cdf0e10cSrcweir void setWarningsContainer( ::dbtools::IWarningsContainer* _pWarnings ) { m_pWarnings = _pWarnings; } getWarningsContainer() const157cdf0e10cSrcweir ::dbtools::IWarningsContainer* getWarningsContainer( ) const { return m_pWarnings; } 158cdf0e10cSrcweir 159cdf0e10cSrcweir // XRename 160cdf0e10cSrcweir virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); 161cdf0e10cSrcweir 162cdf0e10cSrcweir protected: 163cdf0e10cSrcweir virtual void SAL_CALL disposing(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual OColumn* createColumn(const ::rtl::OUString& _rName) const; 166cdf0e10cSrcweir 167cdf0e10cSrcweir virtual void rebuildColumns( ); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // OContentHelper overridables 170cdf0e10cSrcweir virtual ::rtl::OUString determineContentType() const; 171cdf0e10cSrcweir 172cdf0e10cSrcweir private: 173cdf0e10cSrcweir void registerProperties(); 174cdf0e10cSrcweir }; 175cdf0e10cSrcweir 176cdf0e10cSrcweir //........................................................................ 177cdf0e10cSrcweir } // namespace dbaccess 178cdf0e10cSrcweir //........................................................................ 179cdf0e10cSrcweir 180cdf0e10cSrcweir #endif // _DBA_COREAPI_QUERY_HXX_ 181cdf0e10cSrcweir 182cdf0e10cSrcweir 183