fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / core / inc / statement.hxx
blobc1d08623f484d228f57f1e34248d15772fbbce1d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
20 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/sdbc/XStatement.hpp>
24 #include <com/sun/star/sdbc/XConnection.hpp>
25 #include <com/sun/star/util/XCancellable.hpp>
26 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
27 #include <com/sun/star/sdbc/XCloseable.hpp>
28 #include <com/sun/star/sdbc/XMultipleResults.hpp>
29 #include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
30 #include <com/sun/star/sdbc/XBatchExecution.hpp>
31 #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
32 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
33 #include <cppuhelper/propshlp.hxx>
34 #include <comphelper/proparrhlp.hxx>
35 #include "apitools.hxx"
36 #include <comphelper/broadcasthelper.hxx>
38 #include <cppuhelper/implbase3.hxx>
41 // OStatementBase
43 class OStatementBase : public comphelper::OBaseMutex,
44 public OSubComponent,
45 public ::cppu::OPropertySetHelper,
46 public ::comphelper::OPropertyArrayUsageHelper < OStatementBase >,
47 public ::com::sun::star::util::XCancellable,
48 public ::com::sun::star::sdbc::XWarningsSupplier,
49 public ::com::sun::star::sdbc::XPreparedBatchExecution,
50 public ::com::sun::star::sdbc::XMultipleResults,
51 public ::com::sun::star::sdbc::XCloseable,
52 public ::com::sun::star::sdbc::XGeneratedResultSet
54 protected:
55 ::osl::Mutex m_aCancelMutex;
57 ::com::sun::star::uno::WeakReferenceHelper m_aResultSet;
58 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAggregateAsSet;
59 ::com::sun::star::uno::Reference< ::com::sun::star::util::XCancellable > m_xAggregateAsCancellable;
60 bool m_bUseBookmarks;
61 bool m_bEscapeProcessing;
63 virtual ~OStatementBase();
65 public:
66 OStatementBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _xConn,
67 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _xStatement);
70 // ::com::sun::star::lang::XTypeProvider
71 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 // ::com::sun::star::uno::XInterface
74 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
76 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
78 // OComponentHelper
79 virtual void SAL_CALL disposing() SAL_OVERRIDE;
81 // com::sun::star::beans::XPropertySet
82 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 // comphelper::OPropertyArrayUsageHelper
85 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
87 // cppu::OPropertySetHelper
88 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
90 virtual sal_Bool SAL_CALL convertFastPropertyValue(
91 ::com::sun::star::uno::Any & rConvertedValue,
92 ::com::sun::star::uno::Any & rOldValue,
93 sal_Int32 nHandle,
94 const ::com::sun::star::uno::Any& rValue )
95 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
96 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
97 sal_Int32 nHandle,
98 const ::com::sun::star::uno::Any& rValue
100 throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
101 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
103 // ::com::sun::star::sdbc::XWarningsSupplier
104 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 // ::com::sun::star::util::XCancellable
108 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 // ::com::sun::star::sdbc::XCloseable
111 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 // ::com::sun::star::sdbc::XMultipleResults
114 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // ::com::sun::star::sdbc::XPreparedBatchExecution
119 virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 // ::com::sun::star::sdbc::XGeneratedResultSet
123 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 // Helper
126 void disposeResultSet();
128 protected:
129 using ::cppu::OPropertySetHelper::getFastPropertyValue;
133 // OStatement
135 typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbc::XStatement
136 , ::com::sun::star::lang::XServiceInfo
137 , ::com::sun::star::sdbc::XBatchExecution
138 > OStatement_IFACE;
139 class OStatement :public OStatementBase
140 ,public OStatement_IFACE
142 private:
143 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > m_xAggregateStatement;
144 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer;
145 bool m_bAttemptedComposerCreation;
147 public:
148 OStatement(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _xConn,
149 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _xStatement);
151 DECLARE_XINTERFACE()
152 DECLARE_XTYPEPROVIDER()
154 // ::com::sun::star::lang::XServiceInfo
155 virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 // ::com::sun::star::sdbc::XStatement
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 // OComponentHelper
166 virtual void SAL_CALL disposing() SAL_OVERRIDE;
168 // XBatchExecution
169 virtual void SAL_CALL addBatch( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 using OStatementBase::addBatch;
175 private:
176 /** does escape processing for the given SQL command, if the our EscapeProcessing
177 property allows so.
179 OUString impl_doEscapeProcessing_nothrow( const OUString& _rSQL ) const;
180 bool impl_ensureComposer_nothrow() const;
183 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */