1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
21 #define INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
23 #include "mysqlc_preparedstatement.hxx"
24 #include "mysqlc_statement.hxx"
25 #include "mysqlc_subcomponent.hxx"
27 #include <com/sun/star/sdbc/XCloseable.hpp>
28 #include <com/sun/star/sdbc/XColumnLocate.hpp>
29 #include <com/sun/star/sdbc/XResultSet.hpp>
30 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
31 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
32 #include <com/sun/star/sdbc/XRow.hpp>
33 #include <com/sun/star/sdbc/XRowUpdate.hpp>
34 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
35 #include <com/sun/star/sdbcx/XDeleteRows.hpp>
36 #include <com/sun/star/sdbcx/XRowLocate.hpp>
37 #include <com/sun/star/util/XCancellable.hpp>
39 #include <cppuhelper/compbase12.hxx>
42 namespace connectivity
46 using ::com::sun::star::sdbc::SQLException
;
47 using ::com::sun::star::uno::RuntimeException
;
48 using ::com::sun::star::uno::Any
;
49 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> my_XInputStreamRef
;
50 typedef my_XNameAccessRef my_XNameAccessRef
;
55 typedef ::cppu::WeakComponentImplHelper12
< ::com::sun::star::sdbc::XResultSet
,
56 ::com::sun::star::sdbc::XRow
,
57 ::com::sun::star::sdbc::XResultSetMetaDataSupplier
,
58 ::com::sun::star::util::XCancellable
,
59 ::com::sun::star::sdbc::XWarningsSupplier
,
60 ::com::sun::star::sdbc::XResultSetUpdate
,
61 ::com::sun::star::sdbc::XRowUpdate
,
62 ::com::sun::star::sdbcx::XRowLocate
,
63 ::com::sun::star::sdbcx::XDeleteRows
,
64 ::com::sun::star::sdbc::XCloseable
,
65 ::com::sun::star::sdbc::XColumnLocate
,
66 ::com::sun::star::lang::XServiceInfo
> OResultSet_BASE
;
68 class OResultSet
: public OBase_Mutex
,
69 public OResultSet_BASE
,
70 public ::cppu::OPropertySetHelper
,
71 public OPropertyArrayUsageHelper
<OResultSet
>
74 ::com::sun::star::uno::WeakReferenceHelper m_aStatement
;
75 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> m_xMetaData
;
76 sql::ResultSet
*m_result
;
77 unsigned int fieldCount
;
78 rtl_TextEncoding m_encoding
;
79 // OPropertyArrayUsageHelper
80 ::cppu::IPropertyArrayHelper
* createArrayHelper() const SAL_OVERRIDE
;
82 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
84 sal_Bool SAL_CALL
convertFastPropertyValue(Any
& rConvertedValue
, Any
& rOldValue
, sal_Int32 nHandle
, const Any
& rValue
)
85 throw (::com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
87 void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const Any
& rValue
)
88 throw (::com::sun::star::uno::Exception
, std::exception
) SAL_OVERRIDE
;
90 void SAL_CALL
getFastPropertyValue(Any
& rValue
, sal_Int32 nHandle
) const SAL_OVERRIDE
;
92 // you can't delete objects of this type
93 virtual ~OResultSet();
96 virtual rtl::OUString SAL_CALL
getImplementationName()
97 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual sal_Bool SAL_CALL
supportsService(
100 rtl::OUString
const & ServiceName
) throw (css::uno::RuntimeException
, std::exception
)
103 virtual css::uno::Sequence
<rtl::OUString
> SAL_CALL
104 getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
)
107 OResultSet( OCommonStatement
* pStmt
, sql::ResultSet
*result
, rtl_TextEncoding _encoding
);
109 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> operator *()
111 return ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>(*(OResultSet_BASE
*)this);
114 // ::cppu::OComponentHelper
115 void SAL_CALL
disposing() SAL_OVERRIDE
;
118 Any SAL_CALL
queryInterface(const ::com::sun::star::uno::Type
& rType
)
119 throw(RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
122 void SAL_CALL
release() throw() SAL_OVERRIDE
;
125 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
126 throw(RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
130 throw(RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 sal_Bool SAL_CALL
next() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
134 sal_Bool SAL_CALL
isBeforeFirst() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 sal_Bool SAL_CALL
isAfterLast() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 sal_Bool SAL_CALL
isFirst() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 sal_Bool SAL_CALL
isLast() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 void SAL_CALL
beforeFirst() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 void SAL_CALL
afterLast() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
142 sal_Bool SAL_CALL
first() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 sal_Bool SAL_CALL
last() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 sal_Int32 SAL_CALL
getRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 sal_Bool SAL_CALL
absolute(sal_Int32 row
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 sal_Bool SAL_CALL
relative(sal_Int32 rows
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
149 sal_Bool SAL_CALL
previous() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
151 void SAL_CALL
refreshRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
153 sal_Bool SAL_CALL
rowUpdated() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
154 sal_Bool SAL_CALL
rowInserted() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
155 sal_Bool SAL_CALL
rowDeleted() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
getStatement()
158 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
160 sal_Bool SAL_CALL
wasNull() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 rtl::OUString SAL_CALL
getString(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
164 sal_Bool SAL_CALL
getBoolean(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
165 sal_Int8 SAL_CALL
getByte(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
166 sal_Int16 SAL_CALL
getShort(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 sal_Int32 SAL_CALL
getInt(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
168 sal_Int64 SAL_CALL
getLong(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
170 float SAL_CALL
getFloat(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
171 double SAL_CALL
getDouble(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
173 ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getBytes(sal_Int32 column
)
174 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
175 ::com::sun::star::util::Date SAL_CALL
getDate(sal_Int32 column
)
176 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 ::com::sun::star::util::Time SAL_CALL
getTime(sal_Int32 column
)
178 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 ::com::sun::star::util::DateTime SAL_CALL
getTimestamp(sal_Int32 column
)
180 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 my_XInputStreamRef SAL_CALL
getBinaryStream(sal_Int32 column
)
183 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 my_XInputStreamRef SAL_CALL
getCharacterStream(sal_Int32 column
)
185 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 Any SAL_CALL
getObject(sal_Int32 column
, const my_XNameAccessRef
& typeMap
)
188 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
190 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRef
> SAL_CALL
getRef(sal_Int32 column
)
191 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XBlob
> SAL_CALL
getBlob(sal_Int32 column
)
193 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
194 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XClob
> SAL_CALL
getClob(sal_Int32 column
)
195 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
196 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XArray
> SAL_CALL
getArray(sal_Int32 column
)
197 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
199 // XResultSetMetaDataSupplier
200 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
getMetaData()
201 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 void SAL_CALL
cancel() throw(RuntimeException
, std::exception
) SAL_OVERRIDE
;
207 void SAL_CALL
close() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
210 Any SAL_CALL
getWarnings() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
212 void SAL_CALL
clearWarnings() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
215 void SAL_CALL
insertRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
216 void SAL_CALL
updateRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
217 void SAL_CALL
deleteRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
218 void SAL_CALL
cancelRowUpdates() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
219 void SAL_CALL
moveToInsertRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
220 void SAL_CALL
moveToCurrentRow() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
223 void SAL_CALL
updateNull(sal_Int32 column
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
224 void SAL_CALL
updateBoolean(sal_Int32 column
, sal_Bool x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
225 void SAL_CALL
updateByte(sal_Int32 column
, sal_Int8 x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 void SAL_CALL
updateShort(sal_Int32 column
, sal_Int16 x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
227 void SAL_CALL
updateInt(sal_Int32 column
, sal_Int32 x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
228 void SAL_CALL
updateLong(sal_Int32 column
, sal_Int64 x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
229 void SAL_CALL
updateFloat(sal_Int32 column
, float x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
230 void SAL_CALL
updateDouble(sal_Int32 column
, double x
) throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
231 void SAL_CALL
updateString(sal_Int32 column
, const rtl::OUString
& x
)
232 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
233 void SAL_CALL
updateBytes(sal_Int32 column
, const ::com::sun::star::uno::Sequence
< sal_Int8
>& x
)
234 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
235 void SAL_CALL
updateDate(sal_Int32 column
, const ::com::sun::star::util::Date
& x
)
236 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
237 void SAL_CALL
updateTime(sal_Int32 column
, const ::com::sun::star::util::Time
& x
)
238 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
239 void SAL_CALL
updateTimestamp(sal_Int32 column
, const ::com::sun::star::util::DateTime
& x
)
240 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
241 void SAL_CALL
updateBinaryStream(sal_Int32 column
, const my_XInputStreamRef
& x
, sal_Int32 length
)
242 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
243 void SAL_CALL
updateCharacterStream(sal_Int32 column
, const my_XInputStreamRef
& x
, sal_Int32 length
)
244 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 void SAL_CALL
updateObject(sal_Int32 column
, const Any
& x
)
246 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
247 void SAL_CALL
updateNumericObject(sal_Int32 column
, const Any
& x
, sal_Int32 scale
)
248 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 sal_Int32 SAL_CALL
findColumn(const rtl::OUString
& columnName
)
252 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
255 Any SAL_CALL
getBookmark() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
257 sal_Bool SAL_CALL
moveToBookmark(const Any
& bookmark
)
258 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
259 sal_Bool SAL_CALL
moveRelativeToBookmark(const Any
& bookmark
, sal_Int32 rows
)
260 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
261 sal_Int32 SAL_CALL
compareBookmarks(const Any
& first
, const Any
& second
)
262 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
263 sal_Bool SAL_CALL
hasOrderedBookmarks() throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
264 sal_Int32 SAL_CALL
hashBookmark(const Any
& bookmark
)
265 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
268 ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
deleteRows(const ::com::sun::star::uno::Sequence
< Any
>& rows
)
269 throw(SQLException
, RuntimeException
, std::exception
) SAL_OVERRIDE
;
271 void checkColumnIndex(sal_Int32 index
) throw(SQLException
, RuntimeException
);
274 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
278 #endif // CONNECTIVITY_SRESULTSET_HXX
285 * vim600: noet sw=4 ts=4 fdm=marker
286 * vim<600: noet sw=4 ts=4
289 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */