update emoji autocorrect entries from po-files
[LibreOffice.git] / connectivity / source / drivers / firebird / ResultSet.hxx
blobe1f2c689452a75066c6ade0eaf214d6b5d153720
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 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
23 #include "Statement.hxx"
25 #include <ibase.h>
27 #include <connectivity/FValue.hxx>
28 #include <connectivity/OSubComponent.hxx>
29 #include <cppuhelper/compbase7.hxx>
30 #include <comphelper/proparrhlp.hxx>
31 #include <comphelper/propertycontainer.hxx>
33 #include <com/sun/star/util/XCancellable.hpp>
34 #include <com/sun/star/sdbc/FetchDirection.hpp>
35 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
36 #include <com/sun/star/sdbc/ResultSetType.hpp>
37 #include <com/sun/star/sdbc/XCloseable.hpp>
38 #include <com/sun/star/sdbc/XColumnLocate.hpp>
39 #include <com/sun/star/sdbc/XResultSet.hpp>
40 #include <com/sun/star/sdbc/XRow.hpp>
41 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
42 #if 0
43 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
44 #endif
46 namespace connectivity
48 namespace firebird
51 ** OResultSet
53 typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet,
54 ::com::sun::star::sdbc::XRow,
55 ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
56 ::com::sun::star::util::XCancellable,
57 #if 0
58 ::com::sun::star::sdbc::XWarningsSupplier,
59 #endif
60 ::com::sun::star::sdbc::XCloseable,
61 ::com::sun::star::sdbc::XColumnLocate,
62 ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
64 /**
65 * This ResultSet does not deal with the management of the SQLDA
66 * it is supplied with. The owner must mange its SQLDA appropriately
67 * and ensure that the ResultSet is destroyed before disposing of the
68 * SQLDA.
70 class OResultSet: public OResultSet_BASE,
71 public ::comphelper::OPropertyContainer,
72 public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
74 private:
75 bool m_bIsBookmarkable;
76 sal_Int32 m_nFetchSize;
77 sal_Int32 m_nResultSetType;
78 sal_Int32 m_nFetchDirection;
79 sal_Int32 m_nResultSetConcurrency;
81 protected:
82 // Connection kept alive by m_xStatement
83 Connection* m_pConnection;
84 ::osl::Mutex& m_rMutex;
85 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& m_xStatement;
87 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
89 XSQLDA* m_pSqlda;
90 isc_stmt_handle m_statementHandle;
92 bool m_bWasNull;
93 // Row numbering starts with 0 for "in front of first row"
94 sal_Int32 m_currentRow;
95 bool m_bIsAfterLastRow;
97 const sal_Int32 m_fieldCount;
98 ISC_STATUS_ARRAY m_statusVector;
100 bool isNull(const sal_Int32 nColumnIndex);
102 template <typename T> T retrieveValue(const sal_Int32 nColumnIndex,
103 const ISC_SHORT nType);
105 template <typename T> T safelyRetrieveValue(
106 const sal_Int32 nColumnIndex,
107 const ISC_SHORT nType = 0);
109 // OIdPropertyArrayUsageHelper
110 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
111 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
113 void SAL_CALL checkColumnIndex( sal_Int32 index )
114 throw (::com::sun::star::sdbc::SQLException,
115 ::com::sun::star::uno::RuntimeException);
116 void SAL_CALL checkRowIndex()
117 throw (::com::sun::star::sdbc::SQLException,
118 ::com::sun::star::uno::RuntimeException);
120 // you can't delete objects of this type
121 virtual ~OResultSet();
122 public:
123 DECLARE_SERVICE_INFO();
125 OResultSet(Connection* pConnection,
126 ::osl::Mutex& rMutex,
127 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xStatement,
128 isc_stmt_handle& aStatementHandle,
129 XSQLDA* aSqlda);
131 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
133 return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
136 // XInterface
137 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
138 const ::com::sun::star::uno::Type& rType)
139 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
141 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
142 //XTypeProvider
143 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 // XPropertySet
145 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 // XResultSet
147 virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
148 virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 // XRow
166 virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 // XResultSetMetaDataSupplier
187 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 // XCancellable
189 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
190 // XCloseable
191 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
192 // XWarningsSupplier
193 #if 0
194 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
195 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
196 #endif
198 // XColumnLocate
199 virtual sal_Int32 SAL_CALL findColumn(const ::rtl::OUString& columnName)
200 throw(::com::sun::star::sdbc::SQLException,
201 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
205 // Specialisations have to be in the namespace and can't be within the class.
206 template <> ::com::sun::star::util::Date
207 OResultSet::retrieveValue(
208 const sal_Int32 nColumnIndex,
209 const ISC_SHORT nType);
210 template <> ::connectivity::ORowSetValue
211 OResultSet::retrieveValue(
212 const sal_Int32 nColumnIndex,
213 const ISC_SHORT nType);
214 template <> ::com::sun::star::util::Time
215 OResultSet::retrieveValue(
216 const sal_Int32 nColumnIndex,
217 const ISC_SHORT nType);
218 template <> ::com::sun::star::util::DateTime
219 OResultSet::retrieveValue(
220 const sal_Int32 nColumnIndex,
221 const ISC_SHORT nType);
222 template <> ISC_QUAD*
223 OResultSet::retrieveValue(
224 const sal_Int32 nColumnIndex,
225 const ISC_SHORT nType);
226 template <> ::rtl::OUString
227 OResultSet::retrieveValue(
228 const sal_Int32 nColumnIndex,
229 const ISC_SHORT nType);
230 template <> ISC_QUAD*
231 OResultSet::retrieveValue(
232 const sal_Int32 nColumnIndex,
233 const ISC_SHORT nType);
236 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */