LibreOffice Module connectivity (master) 1
JStatement.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 <java/lang/Object.hxx>
22#include <com/sun/star/sdbc/XStatement.hpp>
23#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
24#include <com/sun/star/sdbc/XMultipleResults.hpp>
25#include <com/sun/star/sdbc/XBatchExecution.hpp>
26#include <com/sun/star/sdbc/XCloseable.hpp>
27#include <com/sun/star/util/XCancellable.hpp>
28#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
33#include <com/sun/star/lang/XServiceInfo.hpp>
34
37
38namespace connectivity
39{
40
41 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement,
42 css::sdbc::XWarningsSupplier,
43 css::util::XCancellable,
44 css::sdbc::XCloseable,
45 css::sdbc::XGeneratedResultSet,
46 css::sdbc::XMultipleResults> java_sql_Statement_BASE;
47
48 //************ Class: java.sql.Statement
49
52 public java_lang_Object,
54 public ::comphelper::OPropertyArrayUsageHelper<java_sql_Statement_Base>
55
56 {
57
60 sal_Int32 getQueryTimeOut();
63 sal_Int32 getMaxFieldSize();
66 sal_Int32 getMaxRows();
69 sal_Int32 getResultSetConcurrency();
72 sal_Int32 getResultSetType();
75 sal_Int32 getFetchDirection();
78 sal_Int32 getFetchSize();
81 OUString getCursorName();
82
85 void setQueryTimeOut(sal_Int32 _par0);
88 void setMaxFieldSize(sal_Int32 _par0);
91 void setMaxRows(sal_Int32 _par0);
94 void setResultSetConcurrency(sal_Int32 _par0);
97 void setResultSetType(sal_Int32 _par0);
100 void setFetchDirection(sal_Int32 _par0);
103 void setFetchSize(sal_Int32 _par0);
106 void setCursorName(const OUString &_par0);
109 void setEscapeProcessing(bool _par0);
110
111 protected:
112 css::uno::Reference< css::sdbc::XStatement> m_xGeneratedStatement;
116 // Properties
120
121
122 // Static data for the class
123 static jclass theClass;
124
125 // OPropertyArrayUsageHelper
126 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
127 // OPropertySetHelper
128 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
129
130 virtual sal_Bool SAL_CALL convertFastPropertyValue(
131 css::uno::Any & rConvertedValue,
132 css::uno::Any & rOldValue,
133 sal_Int32 nHandle,
134 const css::uno::Any& rValue
135 ) override;
136
137 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
138 sal_Int32 nHandle,
139 const css::uno::Any& rValue
140 ) override;
141
142 virtual void SAL_CALL getFastPropertyValue(
143 css::uno::Any& rValue,
144 sal_Int32 nHandle
145 ) const override;
146
147 virtual void createStatement(JNIEnv* _pEnv) = 0;
148
149 virtual ~java_sql_Statement_Base() override;
150
151 sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID);
152 sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault);
153
154 public:
155 virtual jclass getMyClass() const override;
156
157 // A ctor that is needed for returning the object
158 java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon );
159
160 sal_Int32 getStatementObjectID() const { return m_aLogger.getObjectID(); }
161
162 // OComponentHelper
163 virtual void SAL_CALL disposing() override;
164 // XInterface
165 virtual void SAL_CALL acquire() noexcept override;
166 virtual void SAL_CALL release() noexcept override;
167 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
168 //XTypeProvider
169 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
170
171 // XPropertySet
172 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
173 // XStatement
174 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ;
175 virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ;
176 virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ;
177 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ;
178 // XWarningsSupplier
179 virtual css::uno::Any SAL_CALL getWarnings( ) override;
180 virtual void SAL_CALL clearWarnings( ) override;
181 // XCancellable
182 virtual void SAL_CALL cancel( ) override;
183 // XCloseable
184 virtual void SAL_CALL close( ) override;
185 // XMultipleResults
186 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override;
187 virtual sal_Int32 SAL_CALL getUpdateCount( ) override;
188 virtual sal_Bool SAL_CALL getMoreResults( ) override;
189 //XGeneratedResultSet
190 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) override;
191
192 public:
194 };
195
197
198 {
199 public:
200 OStatement_BASE2(JNIEnv * pEnv, java_sql_Connection& _rCon ) : java_sql_Statement_Base( pEnv, _rCon ) {}
201
202 // OComponentHelper
203 virtual void SAL_CALL disposing() override;
204 };
205
207 public css::sdbc::XBatchExecution,
208 public css::lang::XServiceInfo
209 {
210 protected:
211 // Static data for the class
212 static jclass theClass;
213
214 virtual void createStatement(JNIEnv* _pEnv) override;
215
216 virtual ~java_sql_Statement() override;
217 public:
219 virtual jclass getMyClass() const override;
220
221 // A ctor that is needed for returning the object
222 java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){};
223
224 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
225 virtual void SAL_CALL acquire() noexcept override;
226 virtual void SAL_CALL release() noexcept override;
227 // XBatchExecution
228 virtual void SAL_CALL addBatch( const OUString& sql ) override;
229 virtual void SAL_CALL clearBatch( ) override;
230 virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override;
231 };
232}
233
234/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OStatement_BASE2(JNIEnv *pEnv, java_sql_Connection &_rCon)
Definition: JStatement.hxx:200
java::sql::ConnectionLog m_aLogger
Definition: JStatement.hxx:114
virtual void SAL_CALL close() override
Definition: JStatement.cxx:187
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues() override
Definition: JStatement.cxx:136
sal_Int32 impl_getProperty(const char *_pMethodName, jmethodID &_inout_MethodID)
Definition: JStatement.cxx:435
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
Definition: JStatement.cxx:279
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: JStatement.cxx:653
virtual jclass getMyClass() const override
Definition: JStatement.cxx:94
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: JStatement.cxx:371
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: JStatement.cxx:647
virtual void SAL_CALL clearWarnings() override
Definition: JStatement.cxx:389
css::uno::Reference< css::sdbc::XStatement > m_xGeneratedStatement
Definition: JStatement.hxx:112
virtual sal_Bool SAL_CALL execute(const OUString &sql) override
Definition: JStatement.cxx:210
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: JStatement.cxx:118
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: JStatement.cxx:577
void setQueryTimeOut(sal_Int32 _par0)
Definition: JStatement.cxx:477
void setFetchDirection(sal_Int32 _par0)
Definition: JStatement.cxx:531
virtual sal_Bool SAL_CALL getMoreResults() override
Definition: JStatement.cxx:364
virtual sal_Int32 SAL_CALL executeUpdate(const OUString &sql) override
Definition: JStatement.cxx:327
void setFetchSize(sal_Int32 _par0)
Definition: JStatement.cxx:542
void setResultSetType(sal_Int32 _par0)
Definition: JStatement.cxx:521
virtual ~java_sql_Statement_Base() override
Definition: JStatement.cxx:73
virtual void SAL_CALL release() noexcept override
Definition: JStatement.cxx:843
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery(const OUString &sql) override
Definition: JStatement.cxx:244
virtual void SAL_CALL disposing() override
Definition: JStatement.cxx:102
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: JStatement.cxx:698
virtual sal_Int32 SAL_CALL getUpdateCount() override
Definition: JStatement.cxx:353
rtl::Reference< java_sql_Connection > m_pConnection
Definition: JStatement.hxx:113
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: JStatement.cxx:858
virtual void SAL_CALL cancel() override
Definition: JStatement.cxx:178
void setCursorName(const OUString &_par0)
Definition: JStatement.cxx:564
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet() override
Definition: JStatement.cxx:341
void setResultSetConcurrency(sal_Int32 _par0)
Definition: JStatement.cxx:511
virtual void createStatement(JNIEnv *_pEnv)=0
java_sql_Statement_Base(JNIEnv *pEnv, java_sql_Connection &_rCon)
Definition: JStatement.cxx:60
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: JStatement.cxx:110
void setMaxFieldSize(sal_Int32 _par0)
Definition: JStatement.cxx:554
virtual void SAL_CALL acquire() noexcept override
Definition: JStatement.cxx:838
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: JStatement.cxx:739
java_sql_Statement(JNIEnv *pEnv, java_sql_Connection &_rCon)
Definition: JStatement.hxx:222
Type
::cppu::WeakComponentImplHelper< css::sdbc::XStatement, css::sdbc::XWarningsSupplier, css::util::XCancellable, css::sdbc::XCloseable, css::sdbc::XGeneratedResultSet, css::sdbc::XMultipleResults > java_sql_Statement_BASE
Definition: JStatement.hxx:46
unsigned char sal_Bool