cid#1607171 Data race condition
[LibreOffice.git] / connectivity / source / inc / java / sql / ResultSet.hxx
blob2b4190ba956ef3b0a575655ec45adceadba844c4
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 #pragma once
21 #include <java/lang/Object.hxx>
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 #include <com/sun/star/sdbc/XRow.hpp>
24 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
25 #include <com/sun/star/sdbc/XCloseable.hpp>
26 #include <com/sun/star/sdbc/XColumnLocate.hpp>
27 #include <com/sun/star/util/XCancellable.hpp>
28 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
29 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
30 #include <com/sun/star/sdbc/XRowUpdate.hpp>
31 #include <cppuhelper/compbase.hxx>
32 #include <comphelper/proparrhlp.hxx>
33 #include <connectivity/CommonTools.hxx>
34 #include <java/sql/JStatement.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <java/sql/ConnectionLog.hxx>
38 namespace connectivity
42 ** java_sql_ResultSet
44 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
45 css::sdbc::XRow,
46 css::sdbc::XResultSetMetaDataSupplier,
47 css::util::XCancellable,
48 css::sdbc::XWarningsSupplier,
49 css::sdbc::XResultSetUpdate,
50 css::sdbc::XRowUpdate,
51 css::sdbc::XCloseable,
52 css::sdbc::XColumnLocate,
53 css::lang::XServiceInfo> java_sql_ResultSet_BASE;
55 class java_sql_Connection;
56 class java_sql_ResultSet : public cppu::BaseMutex,
57 public java_sql_ResultSet_BASE,
58 public java_lang_Object,
59 public ::cppu::OPropertySetHelper,
60 public ::comphelper::OPropertyArrayUsageHelper<java_sql_ResultSet>
62 rtl::Reference<java_sql_Statement_Base> m_xStatement;
63 java::sql::ConnectionLog m_aLogger;
64 java_sql_Connection* m_pConnection;
66 /// @throws css::sdbc::SQLException
67 /// @throws css::uno::RuntimeException
68 sal_Int32 getResultSetConcurrency() const;
69 /// @throws css::sdbc::SQLException
70 /// @throws css::uno::RuntimeException
71 sal_Int32 getResultSetType() const;
72 /// @throws css::sdbc::SQLException
73 /// @throws css::uno::RuntimeException
74 sal_Int32 getFetchDirection() const;
75 /// @throws css::sdbc::SQLException
76 /// @throws css::uno::RuntimeException
77 sal_Int32 getFetchSize() const;
78 /// @throws css::sdbc::SQLException
79 /// @throws css::uno::RuntimeException
80 OUString getCursorName() const;
82 /// @throws css::sdbc::SQLException
83 /// @throws css::uno::RuntimeException
84 void setFetchDirection(sal_Int32 _par0);
85 /// @throws css::sdbc::SQLException
86 /// @throws css::uno::RuntimeException
87 void setFetchSize(sal_Int32 _par0);
88 protected:
89 // Static data for the class
90 static jclass theClass;
92 // OPropertyArrayUsageHelper
93 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
94 // OPropertySetHelper
95 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
97 virtual sal_Bool SAL_CALL convertFastPropertyValue(
98 css::uno::Any & rConvertedValue,
99 css::uno::Any & rOldValue,
100 sal_Int32 nHandle,
101 const css::uno::Any& rValue ) override;
102 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
103 sal_Int32 nHandle,
104 const css::uno::Any& rValue
105 ) override;
106 virtual void SAL_CALL getFastPropertyValue(
107 css::uno::Any& rValue,
108 sal_Int32 nHandle
109 ) const override;
110 virtual ~java_sql_ResultSet() override;
111 public:
112 DECLARE_SERVICE_INFO();
113 virtual jclass getMyClass() const override;
114 // A ctor that is needed for returning the object
115 java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rParentLogger,java_sql_Connection& _rConnection,
116 java_sql_Statement_Base* pStmt = nullptr );
118 // ::cppu::OComponentHelper
119 virtual void SAL_CALL disposing() override;
120 // XInterface
121 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
122 virtual void SAL_CALL acquire() noexcept override;
123 virtual void SAL_CALL release() noexcept override;
124 //XTypeProvider
125 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
126 // XPropertySet
127 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
128 // XResultSet
129 virtual sal_Bool SAL_CALL next( ) override;
130 virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
131 virtual sal_Bool SAL_CALL isAfterLast( ) override;
132 virtual sal_Bool SAL_CALL isFirst( ) override;
133 virtual sal_Bool SAL_CALL isLast( ) override;
134 virtual void SAL_CALL beforeFirst( ) override;
135 virtual void SAL_CALL afterLast( ) override;
136 virtual sal_Bool SAL_CALL first( ) override;
137 virtual sal_Bool SAL_CALL last( ) override;
138 virtual sal_Int32 SAL_CALL getRow( ) override;
139 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
140 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
141 virtual sal_Bool SAL_CALL previous( ) override;
142 virtual void SAL_CALL refreshRow( ) override;
143 virtual sal_Bool SAL_CALL rowUpdated( ) override;
144 virtual sal_Bool SAL_CALL rowInserted( ) override;
145 virtual sal_Bool SAL_CALL rowDeleted( ) override;
146 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
147 // XRow
148 virtual sal_Bool SAL_CALL wasNull( ) override;
149 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
150 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
151 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
152 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
153 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
154 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
155 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
156 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
157 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
158 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
159 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
160 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
161 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
162 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
163 virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
164 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
165 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
166 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
167 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
168 // XResultSetMetaDataSupplier
169 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
170 // XCancellable
171 virtual void SAL_CALL cancel( ) override;
172 // XCloseable
173 virtual void SAL_CALL close( ) override;
174 // XWarningsSupplier
175 virtual css::uno::Any SAL_CALL getWarnings( ) override;
176 virtual void SAL_CALL clearWarnings( ) override;
177 // XResultSetUpdate
178 virtual void SAL_CALL insertRow( ) override;
179 virtual void SAL_CALL updateRow( ) override;
180 virtual void SAL_CALL deleteRow( ) override;
181 virtual void SAL_CALL cancelRowUpdates( ) override;
182 virtual void SAL_CALL moveToInsertRow( ) override;
183 virtual void SAL_CALL moveToCurrentRow( ) override;
184 // XRowUpdate
185 virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override;
186 virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override;
187 virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override;
188 virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override;
189 virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override;
190 virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override;
191 virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override;
192 virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override;
193 virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override;
194 virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override;
195 virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override;
196 virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override;
197 virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override;
198 virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
199 virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override;
200 virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override;
201 virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override;
202 // XColumnLocate
203 virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
205 public:
206 using ::cppu::OPropertySetHelper::getFastPropertyValue;
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */