LibreOffice Module dbaccess (master) 1
statement.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <com/sun/star/lang/XServiceInfo.hpp>
22#include <com/sun/star/sdbc/XStatement.hpp>
23#include <com/sun/star/sdbc/XConnection.hpp>
24#include <com/sun/star/util/XCancellable.hpp>
25#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
26#include <com/sun/star/sdbc/XCloseable.hpp>
27#include <com/sun/star/sdbc/XMultipleResults.hpp>
28#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
29#include <com/sun/star/sdbc/XBatchExecution.hpp>
30#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
31#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
36#include <apitools.hxx>
37
38
39// OStatementBase
40
42 public OSubComponent,
44 public ::comphelper::OPropertyArrayUsageHelper < OStatementBase >,
45 public css::util::XCancellable,
46 public css::sdbc::XWarningsSupplier,
47 public css::sdbc::XPreparedBatchExecution,
48 public css::sdbc::XMultipleResults,
49 public css::sdbc::XCloseable,
50 public css::sdbc::XGeneratedResultSet
51{
52protected:
53 ::osl::Mutex m_aCancelMutex;
54
55 css::uno::WeakReferenceHelper m_aResultSet;
56 css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet;
57 css::uno::Reference< css::util::XCancellable > m_xAggregateAsCancellable;
60
61 virtual ~OStatementBase() override;
62
63public:
64 OStatementBase(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
65 const css::uno::Reference< css::uno::XInterface > & _xStatement);
66
67
68// css::lang::XTypeProvider
69 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
70
71// css::uno::XInterface
72 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
73 virtual void SAL_CALL acquire() noexcept override;
74 virtual void SAL_CALL release() noexcept override;
75
76// OComponentHelper
77 virtual void SAL_CALL disposing() override;
78
79// css::beans::XPropertySet
80 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
81
82// comphelper::OPropertyArrayUsageHelper
83 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
84
85// cppu::OPropertySetHelper
86 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
87
88 virtual sal_Bool SAL_CALL convertFastPropertyValue(
89 css::uno::Any & rConvertedValue,
90 css::uno::Any & rOldValue,
91 sal_Int32 nHandle,
92 const css::uno::Any& rValue ) override;
93 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
94 sal_Int32 nHandle,
95 const css::uno::Any& rValue
96 ) override;
97 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
98
99// css::sdbc::XWarningsSupplier
100 virtual css::uno::Any SAL_CALL getWarnings( ) override;
101 virtual void SAL_CALL clearWarnings( ) override;
102
103// css::util::XCancellable
104 virtual void SAL_CALL cancel( ) override;
105
106// css::sdbc::XCloseable
107 virtual void SAL_CALL close( ) override;
108
109// css::sdbc::XMultipleResults
110 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override;
111 virtual sal_Int32 SAL_CALL getUpdateCount( ) override;
112 virtual sal_Bool SAL_CALL getMoreResults( ) override;
113
114// css::sdbc::XPreparedBatchExecution
115 virtual void SAL_CALL addBatch( ) override;
116 virtual void SAL_CALL clearBatch( ) override;
117 virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override;
118// css::sdbc::XGeneratedResultSet
119 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) override;
120
121// Helper
122 void disposeResultSet();
123
124protected:
126};
127
128
129// OStatement
130
131typedef ::cppu::ImplHelper3 < css::sdbc::XStatement
132 , css::lang::XServiceInfo
133 , css::sdbc::XBatchExecution
136 ,public OStatement_IFACE
137{
138private:
139 css::uno::Reference< css::sdbc::XStatement > m_xAggregateStatement;
140 css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer;
142
143public:
144 OStatement(const css::uno::Reference< css::sdbc::XConnection > & _xConn,
145 const css::uno::Reference< css::uno::XInterface > & _xStatement);
146
148 DECLARE_XTYPEPROVIDER()
149
150// css::lang::XServiceInfo
151 virtual OUString SAL_CALL getImplementationName( ) override;
152 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
153 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
154
155// css::sdbc::XStatement
156 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override;
157 virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override;
158 virtual sal_Bool SAL_CALL execute( const OUString& sql ) override;
159 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override;
160
161 // OComponentHelper
162 virtual void SAL_CALL disposing() override;
163
164 // XBatchExecution
165 virtual void SAL_CALL addBatch( const OUString& sql ) override;
166 virtual void SAL_CALL clearBatch( ) override;
167 virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override;
168
170
171private:
175 OUString impl_doEscapeProcessing_nothrow( const OUString& _rSQL ) const;
176 bool impl_ensureComposer_nothrow() const;
177};
178
179/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL acquire() noexcept override
Definition: statement.cxx:111
bool m_bUseBookmarks
Definition: statement.hxx:58
virtual sal_Int32 SAL_CALL getUpdateCount() override
Definition: statement.cxx:333
virtual void SAL_CALL clearWarnings() override
Definition: statement.cxx:301
virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch() override
Definition: statement.cxx:389
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: statement.cxx:64
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: statement.cxx:83
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: statement.cxx:199
css::uno::WeakReferenceHelper m_aResultSet
Definition: statement.hxx:55
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: statement.cxx:204
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues() override
Definition: statement.cxx:405
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet() override
Definition: statement.cxx:320
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: statement.cxx:293
virtual void SAL_CALL clearBatch() override
Definition: statement.cxx:376
virtual void SAL_CALL close() override
Definition: statement.cxx:163
virtual void SAL_CALL release() noexcept override
Definition: statement.cxx:116
virtual sal_Bool SAL_CALL getMoreResults() override
Definition: statement.cxx:346
OStatementBase(const css::uno::Reference< css::sdbc::XConnection > &_xConn, const css::uno::Reference< css::uno::XInterface > &_xStatement)
Definition: statement.cxx:46
virtual void SAL_CALL disposing() override
Definition: statement.cxx:131
void disposeResultSet()
Definition: statement.cxx:121
bool m_bEscapeProcessing
Definition: statement.hxx:59
virtual void SAL_CALL addBatch() override
Definition: statement.cxx:363
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: statement.cxx:179
css::uno::Reference< css::util::XCancellable > m_xAggregateAsCancellable
Definition: statement.hxx:57
virtual ~OStatementBase() override
Definition: statement.cxx:59
virtual void SAL_CALL cancel() override
Definition: statement.cxx:310
::osl::Mutex m_aCancelMutex
Definition: statement.hxx:53
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: statement.cxx:173
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: statement.cxx:267
css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet
Definition: statement.hxx:56
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: statement.cxx:238
OStatement(const css::uno::Reference< css::sdbc::XConnection > &_xConn, const css::uno::Reference< css::uno::XInterface > &_xStatement)
css::uno::Reference< css::sdbc::XStatement > m_xAggregateStatement
Definition: statement.hxx:139
bool m_bAttemptedComposerCreation
Definition: statement.hxx:141
css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer
Definition: statement.hxx:140
OPropertySetHelper(OBroadcastHelper &rBHelper)
unsigned char sal_Bool
#define DECLARE_XINTERFACE()