LibreOffice Module dbaccess (master) 1
datacolumn.cxx
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
20#include "datacolumn.hxx"
23#include <strings.hxx>
24
25using namespace dbaccess;
26using namespace ::com::sun::star::sdbc;
27using namespace ::com::sun::star::sdb;
28using namespace ::com::sun::star::beans;
29using namespace ::com::sun::star::uno;
30using namespace ::com::sun::star::lang;
31using namespace ::com::sun::star::container;
32using namespace ::osl;
33using namespace ::comphelper;
34using namespace ::cppu;
35
36
37ODataColumn::ODataColumn(
38 const Reference < XResultSetMetaData >& _xMetaData,
39 const Reference < XRow >& _xRow,
40 const Reference < XRowUpdate >& _xRowUpdate,
41 sal_Int32 _nPos,
42 const Reference< XDatabaseMetaData >& _rxDBMeta)
43 :OResultColumn(_xMetaData, _nPos, _rxDBMeta)
44 ,m_xRow(_xRow)
45 ,m_xRowUpdate(_xRowUpdate)
46{
47}
48
50{
51}
52
53// css::lang::XTypeProvider
54Sequence< Type > ODataColumn::getTypes()
55{
56 OTypeCollection aTypes(cppu::UnoType<XColumn>::get(),
58 OColumn::getTypes());
59 return aTypes.getTypes();
60}
61
63{
64 return css::uno::Sequence<sal_Int8>();
65}
66
67Any SAL_CALL ODataColumn::queryInterface( const Type & _rType )
68{
69 Any aReturn = OResultColumn::queryInterface(_rType);
70 if (!aReturn.hasValue())
71 aReturn = ::cppu::queryInterface(_rType,
72 static_cast< XColumn* >(this),
73 static_cast< XColumnUpdate* >(this)
74 );
75 return aReturn;
76}
77
78// XServiceInfo
80{
81 return "com.sun.star.sdb.ODataColumn";
82}
83
85{
87}
88
89// OComponentHelper
91{
93
94 m_xRow = nullptr;
95 m_xRowUpdate = nullptr;
96}
97
98// css::sdb::XColumn
100{
101 MutexGuard aGuard(m_aMutex);
102 ::connectivity::checkDisposed(!m_xRow.is());
103
104 return m_xRow->wasNull();
105}
106
108{
109 MutexGuard aGuard(m_aMutex);
110 ::connectivity::checkDisposed(!m_xRow.is());
111
112 return m_xRow->getString(m_nPos);
113}
114
116{
117 MutexGuard aGuard(m_aMutex);
118 ::connectivity::checkDisposed(!m_xRow.is());
119
120 return m_xRow->getBoolean(m_nPos);
121}
122
124{
125 MutexGuard aGuard(m_aMutex);
126 ::connectivity::checkDisposed(!m_xRow.is());
127
128 return m_xRow->getByte(m_nPos);
129}
130
132{
133 MutexGuard aGuard(m_aMutex);
134 ::connectivity::checkDisposed(!m_xRow.is());
135
136 return m_xRow->getShort(m_nPos);
137}
138
140{
141 MutexGuard aGuard(m_aMutex);
142 ::connectivity::checkDisposed(!m_xRow.is());
143
144 return m_xRow->getInt(m_nPos);
145}
146
148{
149 MutexGuard aGuard(m_aMutex);
150 ::connectivity::checkDisposed(!m_xRow.is());
151
152 return m_xRow->getLong(m_nPos);
153}
154
156{
157 MutexGuard aGuard(m_aMutex);
158 ::connectivity::checkDisposed(!m_xRow.is());
159
160 return m_xRow->getFloat(m_nPos);
161}
162
164{
165 MutexGuard aGuard(m_aMutex);
166 ::connectivity::checkDisposed(!m_xRow.is());
167
168 return m_xRow->getDouble(m_nPos);
169}
170
171Sequence< sal_Int8 > ODataColumn::getBytes()
172{
173 MutexGuard aGuard(m_aMutex);
174 ::connectivity::checkDisposed(!m_xRow.is());
175
176 return m_xRow->getBytes(m_nPos);
177}
178
179css::util::Date ODataColumn::getDate()
180{
181 MutexGuard aGuard(m_aMutex);
182 ::connectivity::checkDisposed(!m_xRow.is());
183
184 return m_xRow->getDate(m_nPos);
185}
186
187css::util::Time ODataColumn::getTime()
188{
189 MutexGuard aGuard(m_aMutex);
190 ::connectivity::checkDisposed(!m_xRow.is());
191
192 return m_xRow->getTime(m_nPos);
193}
194
195css::util::DateTime ODataColumn::getTimestamp()
196{
197 MutexGuard aGuard(m_aMutex);
198 ::connectivity::checkDisposed(!m_xRow.is());
199
200 return m_xRow->getTimestamp(m_nPos);
201}
202
203Reference< css::io::XInputStream > ODataColumn::getBinaryStream()
204{
205 MutexGuard aGuard(m_aMutex);
206 ::connectivity::checkDisposed(!m_xRow.is());
207
208 return m_xRow->getBinaryStream(m_nPos);
209}
210
211Reference< css::io::XInputStream > ODataColumn::getCharacterStream()
212{
213 MutexGuard aGuard(m_aMutex);
214 ::connectivity::checkDisposed(!m_xRow.is());
215
216 return m_xRow->getCharacterStream(m_nPos);
217}
218
219Any ODataColumn::getObject(const Reference< css::container::XNameAccess > & typeMap)
220{
221 MutexGuard aGuard(m_aMutex);
222 ::connectivity::checkDisposed(!m_xRow.is());
223
224 return m_xRow->getObject(m_nPos, typeMap);
225}
226
227Reference< XRef > ODataColumn::getRef()
228{
229 MutexGuard aGuard(m_aMutex);
230 ::connectivity::checkDisposed(!m_xRow.is());
231
232 return m_xRow->getRef(m_nPos);
233}
234
235Reference< XBlob > ODataColumn::getBlob()
236{
237 MutexGuard aGuard(m_aMutex);
238 ::connectivity::checkDisposed(!m_xRow.is());
239
240 return m_xRow->getBlob(m_nPos);
241}
242
243Reference< XClob > ODataColumn::getClob()
244{
245 MutexGuard aGuard(m_aMutex);
246 ::connectivity::checkDisposed(!m_xRow.is());
247
248 return m_xRow->getClob(m_nPos);
249}
250
251Reference< XArray > ODataColumn::getArray()
252{
253 MutexGuard aGuard(m_aMutex);
254 ::connectivity::checkDisposed(!m_xRow.is());
255
256 return m_xRow->getArray(m_nPos);
257}
258
259// css::sdb::XColumnUpdate
261{
262 MutexGuard aGuard( m_aMutex );
263 ::connectivity::checkDisposed(!m_xRowUpdate.is());
264
265 m_xRowUpdate->updateNull(m_nPos);
266}
267
269{
270 MutexGuard aGuard( m_aMutex );
271 ::connectivity::checkDisposed(!m_xRowUpdate.is());
272
273 m_xRowUpdate->updateBoolean(m_nPos, x);
274}
275
277{
278 MutexGuard aGuard( m_aMutex );
279 ::connectivity::checkDisposed(!m_xRowUpdate.is());
280
281 m_xRowUpdate->updateByte(m_nPos, x);
282}
283
285{
286 MutexGuard aGuard( m_aMutex );
287 ::connectivity::checkDisposed(!m_xRowUpdate.is());
288
289 m_xRowUpdate->updateShort(m_nPos, x);
290}
291
292void ODataColumn::updateInt(sal_Int32 x)
293{
294 MutexGuard aGuard( m_aMutex );
295 ::connectivity::checkDisposed(!m_xRowUpdate.is());
296
297 m_xRowUpdate->updateInt(m_nPos, x);
298}
299
300void ODataColumn::updateLong(sal_Int64 x)
301{
302 MutexGuard aGuard( m_aMutex );
303 ::connectivity::checkDisposed(!m_xRowUpdate.is());
304
305 m_xRowUpdate->updateLong(m_nPos, x);
306}
307
309{
310 MutexGuard aGuard( m_aMutex );
311 ::connectivity::checkDisposed(!m_xRowUpdate.is());
312
313 m_xRowUpdate->updateFloat(m_nPos, x);
314}
315
317{
318 MutexGuard aGuard( m_aMutex );
319 ::connectivity::checkDisposed(!m_xRowUpdate.is());
320
321 m_xRowUpdate->updateDouble(m_nPos, x);
322}
323
324void ODataColumn::updateString(const OUString& x)
325{
326 MutexGuard aGuard( m_aMutex );
327 ::connectivity::checkDisposed(!m_xRowUpdate.is());
328
329 m_xRowUpdate->updateString(m_nPos, x);
330}
331
332void ODataColumn::updateBytes(const Sequence< sal_Int8 >& x)
333{
334 MutexGuard aGuard( m_aMutex );
335 ::connectivity::checkDisposed(!m_xRowUpdate.is());
336
337 m_xRowUpdate->updateBytes(m_nPos, x);
338}
339
340void ODataColumn::updateDate(const css::util::Date& x)
341{
342 MutexGuard aGuard( m_aMutex );
343 ::connectivity::checkDisposed(!m_xRowUpdate.is());
344
345 m_xRowUpdate->updateDate(m_nPos, x);
346}
347
348void ODataColumn::updateTime(const css::util::Time& x)
349{
350 MutexGuard aGuard( m_aMutex );
351 ::connectivity::checkDisposed(!m_xRowUpdate.is());
352
353 m_xRowUpdate->updateTime(m_nPos, x);
354}
355
356void ODataColumn::updateTimestamp(const css::util::DateTime& x)
357{
358 MutexGuard aGuard( m_aMutex );
359 ::connectivity::checkDisposed(!m_xRowUpdate.is());
360
361 m_xRowUpdate->updateTimestamp(m_nPos, x);
362}
363
364void ODataColumn::updateCharacterStream(const Reference< css::io::XInputStream > & x, sal_Int32 length)
365{
366 MutexGuard aGuard( m_aMutex );
367 ::connectivity::checkDisposed(!m_xRowUpdate.is());
368
369 m_xRowUpdate->updateCharacterStream(m_nPos, x, length);
370}
371
372void ODataColumn::updateBinaryStream(const Reference< css::io::XInputStream > & x, sal_Int32 length)
373{
374 MutexGuard aGuard( m_aMutex );
375 ::connectivity::checkDisposed(!m_xRowUpdate.is());
376
377 m_xRowUpdate->updateBinaryStream(m_nPos, x, length);
378}
379
380void ODataColumn::updateNumericObject(const Any& x, sal_Int32 scale)
381{
382 MutexGuard aGuard( m_aMutex );
383 ::connectivity::checkDisposed(!m_xRowUpdate.is());
384
385 m_xRowUpdate->updateNumericObject(m_nPos, x, scale);
386}
387
389{
390 MutexGuard aGuard( m_aMutex );
391 ::connectivity::checkDisposed(!m_xRowUpdate.is());
392
393 m_xRowUpdate->updateObject(m_nPos, x);
394}
395
396/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Reference< XRow > m_xRow
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray() override
Definition: datacolumn.cxx:251
virtual void SAL_CALL updateObject(const css::uno::Any &x) override
Definition: datacolumn.cxx:388
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob() override
Definition: datacolumn.cxx:235
virtual sal_Int16 SAL_CALL getShort() override
Definition: datacolumn.cxx:131
virtual void SAL_CALL disposing() override
Definition: datacolumn.cxx:90
virtual void SAL_CALL updateNull() override
Definition: datacolumn.cxx:260
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob() override
Definition: datacolumn.cxx:243
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes() override
Definition: datacolumn.cxx:171
virtual css::util::Time SAL_CALL getTime() override
Definition: datacolumn.cxx:187
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef() override
Definition: datacolumn.cxx:227
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: datacolumn.cxx:84
virtual css::util::Date SAL_CALL getDate() override
Definition: datacolumn.cxx:179
virtual sal_Int64 SAL_CALL getLong() override
Definition: datacolumn.cxx:147
virtual void SAL_CALL updateTimestamp(const css::util::DateTime &x) override
Definition: datacolumn.cxx:356
virtual double SAL_CALL getDouble() override
Definition: datacolumn.cxx:163
virtual sal_Int8 SAL_CALL getByte() override
Definition: datacolumn.cxx:123
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: datacolumn.cxx:62
virtual sal_Bool SAL_CALL getBoolean() override
Definition: datacolumn.cxx:115
virtual void SAL_CALL updateShort(sal_Int16 x) override
Definition: datacolumn.cxx:284
virtual void SAL_CALL updateFloat(float x) override
Definition: datacolumn.cxx:308
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream() override
Definition: datacolumn.cxx:211
virtual ~ODataColumn() override
Definition: datacolumn.cxx:49
virtual void SAL_CALL updateTime(const css::util::Time &x) override
Definition: datacolumn.cxx:348
virtual void SAL_CALL updateInt(sal_Int32 x) override
Definition: datacolumn.cxx:292
virtual void SAL_CALL updateLong(sal_Int64 x) override
Definition: datacolumn.cxx:300
virtual css::uno::Any SAL_CALL getObject(const css::uno::Reference< css::container::XNameAccess > &typeMap) override
Definition: datacolumn.cxx:219
virtual void SAL_CALL updateByte(sal_Int8 x) override
Definition: datacolumn.cxx:276
virtual css::util::DateTime SAL_CALL getTimestamp() override
Definition: datacolumn.cxx:195
virtual void SAL_CALL updateBytes(const css::uno::Sequence< sal_Int8 > &x) override
Definition: datacolumn.cxx:332
virtual sal_Int32 SAL_CALL getInt() override
Definition: datacolumn.cxx:139
virtual void SAL_CALL updateBinaryStream(const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
Definition: datacolumn.cxx:372
virtual OUString SAL_CALL getImplementationName() override
Definition: datacolumn.cxx:79
css::uno::Reference< css::sdbc::XRow > m_xRow
Definition: datacolumn.hxx:37
virtual sal_Bool SAL_CALL wasNull() override
Definition: datacolumn.cxx:99
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: datacolumn.cxx:54
virtual void SAL_CALL updateDouble(double x) override
Definition: datacolumn.cxx:316
virtual OUString SAL_CALL getString() override
Definition: datacolumn.cxx:107
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream() override
Definition: datacolumn.cxx:203
virtual void SAL_CALL updateCharacterStream(const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
Definition: datacolumn.cxx:364
virtual float SAL_CALL getFloat() override
Definition: datacolumn.cxx:155
virtual void SAL_CALL updateString(const OUString &x) override
Definition: datacolumn.cxx:324
virtual void SAL_CALL updateBoolean(sal_Bool x) override
Definition: datacolumn.cxx:268
css::uno::Reference< css::sdbc::XRowUpdate > m_xRowUpdate
Definition: datacolumn.hxx:38
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: datacolumn.cxx:67
virtual void SAL_CALL updateDate(const css::util::Date &x) override
Definition: datacolumn.cxx:340
virtual void SAL_CALL updateNumericObject(const css::uno::Any &x, sal_Int32 scale) override
Definition: datacolumn.cxx:380
virtual void SAL_CALL disposing() override
float x
std::mutex m_aMutex
Type
sal_Int32 scale
constexpr OUStringLiteral SERVICE_SDB_RESULTCOLUMN
Definition: strings.hxx:179
constexpr OUStringLiteral SERVICE_SDBCX_COLUMN
Definition: strings.hxx:175
constexpr OUStringLiteral SERVICE_SDB_DATACOLUMN
Definition: strings.hxx:180
unsigned char sal_Bool
signed char sal_Int8
const SvXMLTokenMapEntry aTypes[]
sal_Int32 _nPos