build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / dbaccess / source / core / inc / statement.hxx
blob7d7b7f09ed68944e531d96cf03965dae06f79e37
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 <cppuhelper/basemutex.hxx>
36 #include <cppuhelper/implbase3.hxx>
37 #include "apitools.hxx"
40 // OStatementBase
42 class OStatementBase : public cppu::BaseMutex,
43 public OSubComponent,
44 public ::cppu::OPropertySetHelper,
45 public ::comphelper::OPropertyArrayUsageHelper < OStatementBase >,
46 public css::util::XCancellable,
47 public css::sdbc::XWarningsSupplier,
48 public css::sdbc::XPreparedBatchExecution,
49 public css::sdbc::XMultipleResults,
50 public css::sdbc::XCloseable,
51 public css::sdbc::XGeneratedResultSet
53 protected:
54 ::osl::Mutex m_aCancelMutex;
56 css::uno::WeakReferenceHelper m_aResultSet;
57 css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet;
58 css::uno::Reference< css::util::XCancellable > m_xAggregateAsCancellable;
59 bool m_bUseBookmarks;
60 bool m_bEscapeProcessing;
62 virtual ~OStatementBase() override;
64 public:
65 OStatementBase(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
66 const css::uno::Reference< css::uno::XInterface > & _xStatement);
69 // css::lang::XTypeProvider
70 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) override;
72 // css::uno::XInterface
73 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw (css::uno::RuntimeException, std::exception) override;
74 virtual void SAL_CALL acquire() throw() override;
75 virtual void SAL_CALL release() throw() override;
77 // OComponentHelper
78 virtual void SAL_CALL disposing() override;
80 // css::beans::XPropertySet
81 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception) override;
83 // comphelper::OPropertyArrayUsageHelper
84 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
86 // cppu::OPropertySetHelper
87 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
89 virtual sal_Bool SAL_CALL convertFastPropertyValue(
90 css::uno::Any & rConvertedValue,
91 css::uno::Any & rOldValue,
92 sal_Int32 nHandle,
93 const css::uno::Any& rValue )
94 throw (css::lang::IllegalArgumentException,
95 css::uno::RuntimeException,
96 std::exception) override;
97 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
98 sal_Int32 nHandle,
99 const css::uno::Any& rValue
101 throw (css::uno::Exception, std::exception) override;
102 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
104 // css::sdbc::XWarningsSupplier
105 virtual css::uno::Any SAL_CALL getWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
106 virtual void SAL_CALL clearWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
108 // css::util::XCancellable
109 virtual void SAL_CALL cancel( ) throw(css::uno::RuntimeException, std::exception) override;
111 // css::sdbc::XCloseable
112 virtual void SAL_CALL close( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
114 // css::sdbc::XMultipleResults
115 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
116 virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
117 virtual sal_Bool SAL_CALL getMoreResults( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
119 // css::sdbc::XPreparedBatchExecution
120 virtual void SAL_CALL addBatch( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
121 virtual void SAL_CALL clearBatch( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
122 virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
123 // css::sdbc::XGeneratedResultSet
124 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
126 // Helper
127 void disposeResultSet();
129 protected:
130 using ::cppu::OPropertySetHelper::getFastPropertyValue;
134 // OStatement
136 typedef ::cppu::ImplHelper3 < css::sdbc::XStatement
137 , css::lang::XServiceInfo
138 , css::sdbc::XBatchExecution
139 > OStatement_IFACE;
140 class OStatement :public OStatementBase
141 ,public OStatement_IFACE
143 private:
144 css::uno::Reference< css::sdbc::XStatement > m_xAggregateStatement;
145 css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer;
146 bool m_bAttemptedComposerCreation;
148 public:
149 OStatement(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
150 const css::uno::Reference< css::uno::XInterface > & _xStatement);
152 DECLARE_XINTERFACE()
153 DECLARE_XTYPEPROVIDER()
155 // css::lang::XServiceInfo
156 virtual OUString SAL_CALL getImplementationName( ) throw(css::uno::RuntimeException, std::exception) override;
157 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(css::uno::RuntimeException, std::exception) override;
158 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException, std::exception) override;
160 // css::sdbc::XStatement
161 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
162 virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
163 virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
164 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
166 // OComponentHelper
167 virtual void SAL_CALL disposing() override;
169 // XBatchExecution
170 virtual void SAL_CALL addBatch( const OUString& sql ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
171 virtual void SAL_CALL clearBatch( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
172 virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
174 using OStatementBase::addBatch;
176 private:
177 /** does escape processing for the given SQL command, if the our EscapeProcessing
178 property allows so.
180 OUString impl_doEscapeProcessing_nothrow( const OUString& _rSQL ) const;
181 bool impl_ensureComposer_nothrow() const;
184 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */