1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
23 #include "querydescriptor.hxx"
24 #include <cppuhelper/implbase3.hxx>
25 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
26 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
27 #include <com/sun/star/sdbc/XConnection.hpp>
28 #include <com/sun/star/sdbcx/XRename.hpp>
29 #include "ContentHelper.hxx"
35 class IWarningsContainer
;
41 // OQuery - an object implementing the sdb.Query service
42 typedef ::cppu::ImplHelper3
< ::com::sun::star::sdbcx::XDataDescriptorFactory
,
43 ::com::sun::star::beans::XPropertyChangeListener
,
44 ::com::sun::star::sdbcx::XRename
48 typedef ::comphelper::OPropertyArrayUsageHelper
< OQuery
> OQuery_ArrayHelperBase
;
50 class OQuery
:public OContentHelper
51 ,public OQueryDescriptor_Base
53 ,public OQuery_ArrayHelperBase
56 friend struct TRelease
;
59 typedef ::std::map
< OUString
,OColumn
*,::comphelper::UStringMixLess
> TNameColumnMap
;
62 // TNameColumnMap m_aColumnMap; // contains all columnnames to columns
63 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xCommandDefinition
;
64 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
65 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> m_xCommandPropInfo
;
66 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
67 ::dbtools::IWarningsContainer
* m_pWarnings
;
68 bool m_bCaseSensitiv
: 1; // assume case sensitivity of the column names ?
70 // possible actions on our "aggregate"
71 enum AGGREGATE_ACTION
{ NONE
, SETTING_PROPERTIES
, FLUSHING
};
72 AGGREGATE_ACTION m_eDoingCurrently
;
74 /** a class which automatically resets m_eDoingCurrently in its destructor
76 class OAutoActionReset
; // just for the following friend declaration
77 friend class OAutoActionReset
;
78 class OAutoActionReset
82 OAutoActionReset(OQuery
* _pActor
) : m_pActor(_pActor
) { }
83 ~OAutoActionReset() { m_pActor
->m_eDoingCurrently
= NONE
; }
89 // OPropertyArrayUsageHelper
90 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const SAL_OVERRIDE
;
91 ::cppu::IPropertyArrayHelper
* getArrayHelper() { return OQuery_ArrayHelperBase::getArrayHelper(); }
95 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxCommandDefinition
,
96 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
,
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _xORB
100 virtual css::uno::Sequence
<css::uno::Type
> SAL_CALL
getTypes()
101 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId()
103 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 // ::com::sun::star::uno::XInterface
106 DECLARE_XINTERFACE( )
108 // ::com::sun::star::beans::XPropertySet
109 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 // OPropertySetHelper
112 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
114 // ::com::sun::star::lang::XServiceInfo
115 DECLARE_SERVICE_INFO();
117 // ::com::sun::star::sdbcx::XDataDescriptorFactory
118 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 // ::com::sun::star::beans::XPropertyChangeListener
121 virtual void SAL_CALL
propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 // ::com::sun::star::lang::XEventListener
124 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& _rSource
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 // OPropertySetHelper
127 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
129 const ::com::sun::star::uno::Any
& rValue
)
130 throw (::com::sun::star::uno::Exception
, std::exception
) SAL_OVERRIDE
;
133 // the caller is responsible for the lifetime!
134 void setWarningsContainer( ::dbtools::IWarningsContainer
* _pWarnings
) { m_pWarnings
= _pWarnings
; }
135 ::dbtools::IWarningsContainer
* getWarningsContainer( ) const { return m_pWarnings
; }
138 virtual void SAL_CALL
rename( const OUString
& newName
) throw (::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
143 virtual OColumn
* createColumn(const OUString
& _rName
) const SAL_OVERRIDE
;
145 virtual void rebuildColumns( ) SAL_OVERRIDE
;
147 // OContentHelper overridables
148 virtual OUString
determineContentType() const SAL_OVERRIDE
;
151 void registerProperties();
154 } // namespace dbaccess
156 #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */