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 .
21 #include "KResultSet.hxx"
22 #include "KResultSetMetaData.hxx"
23 #include "KConnection.hxx"
24 #include "kcondition.hxx"
26 #include "kfields.hxx"
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 #include <com/sun/star/sdbcx/CompareBookmark.hpp>
29 #include "TConnection.hxx"
30 #include <connectivity/dbexception.hxx>
31 #include "resource/kab_res.hrc"
32 #include "resource/sharedresources.hxx"
33 #include <tools/time.hxx>
35 using namespace connectivity::kab
;
37 using namespace com::sun::star::uno
;
38 using namespace com::sun::star::lang
;
39 using namespace com::sun::star::beans
;
40 using namespace com::sun::star::sdbc
;
41 using namespace com::sun::star::sdbcx
;
42 using namespace com::sun::star::io
;
43 namespace cssu
= com::sun::star::util
;
45 IMPLEMENT_SERVICE_INFO(KabResultSet
, "com.sun.star.sdbc.drivers.KabResultSet", "com.sun.star.sdbc.ResultSet");
47 KabResultSet::KabResultSet(KabCommonStatement
* pStmt
)
48 : KabResultSet_BASE(m_aMutex
),
49 OPropertySetHelper(KabResultSet_BASE::rBHelper
),
58 KabResultSet::~KabResultSet()
62 void KabResultSet::allKabAddressees()
64 KabConnection
* pConnection
= static_cast< KabConnection
*>(m_xStatement
->getConnection().get());
65 KABC::AddressBook
* pAddressBook
= pConnection
->getAddressBook();
67 m_aKabAddressees
= pAddressBook
->allAddressees();
70 void KabResultSet::someKabAddressees(const KabCondition
*pCondition
)
72 KabConnection
* pConnection
= static_cast< KabConnection
*>(m_xStatement
->getConnection().get());
73 KABC::AddressBook
* pAddressBook
= pConnection
->getAddressBook();
75 KABC::AddressBook::Iterator iterator
;
77 for (iterator
= pAddressBook
->begin();
78 iterator
!= pAddressBook
->end();
81 if (pCondition
->eval(*iterator
))
82 m_aKabAddressees
.push_back(*iterator
);
86 void KabResultSet::sortKabAddressees(const KabOrder
*pOrder
)
88 // We do not use class KAddresseeList, which has a sorting algorithm in it, because
89 // it uses templates. It would expand to more or less the same code as the one
90 // which follows, but it would need not be called in a much less convenient way.
92 KABC::Addressee::List::Iterator
93 begin
= m_aKabAddressees
.begin(),
94 end
= m_aKabAddressees
.end(),
97 // Bubble sort. Feel free to implement a better algorithm.
101 for (iterator
= begin
; iterator
!= end
; ++iterator
)
103 if (pOrder
->compare(*iterator
, *end
) > 0)
104 qSwap(*iterator
, *end
);
109 void KabResultSet::disposing()
111 OPropertySetHelper::disposing();
113 ::osl::MutexGuard
aGuard(m_aMutex
);
115 m_xStatement
.clear();
119 Any SAL_CALL
KabResultSet::queryInterface(const Type
& rType
) throw(RuntimeException
, std::exception
)
121 Any aRet
= OPropertySetHelper::queryInterface(rType
);
122 if (!aRet
.hasValue())
123 aRet
= KabResultSet_BASE::queryInterface(rType
);
127 void SAL_CALL
KabResultSet::acquire() throw()
129 KabResultSet_BASE::acquire();
132 void SAL_CALL
KabResultSet::release() throw()
134 KabResultSet_BASE::release();
137 Sequence
< Type
> SAL_CALL
KabResultSet::getTypes() throw(RuntimeException
, std::exception
)
139 OTypeCollection
aTypes(
140 cppu::UnoType
<css::beans::XMultiPropertySet
>::get(),
141 cppu::UnoType
<css::beans::XFastPropertySet
>::get(),
142 cppu::UnoType
<css::beans::XPropertySet
>::get());
144 return comphelper::concatSequences(aTypes
.getTypes(), KabResultSet_BASE::getTypes());
147 css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
KabResultSet::getPropertySetInfo( ) throw(css::uno::RuntimeException
, std::exception
)
149 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
152 sal_Int32 SAL_CALL
KabResultSet::findColumn(const OUString
& columnName
) throw(SQLException
, RuntimeException
, std::exception
)
154 ::osl::MutexGuard
aGuard( m_aMutex
);
155 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
157 // find the first column with the name columnName
158 Reference
< XResultSetMetaData
> xMeta
= getMetaData();
159 sal_Int32 nLen
= xMeta
->getColumnCount();
161 for (sal_Int32 i
= 1; i
<= nLen
; ++i
)
162 if (xMeta
->isCaseSensitive(i
) ?
163 columnName
== xMeta
->getColumnName(i
) :
164 columnName
.equalsIgnoreAsciiCase(xMeta
->getColumnName(i
)))
167 ::dbtools::throwInvalidColumnException( columnName
, *this );
169 return 0; // Never reached
172 OUString SAL_CALL
KabResultSet::getString(sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
, std::exception
)
174 ::osl::MutexGuard
aGuard( m_aMutex
);
175 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
178 sal_Int32 nAddressees
= m_aKabAddressees
.size();
179 ::KABC::Field::List aFields
= ::KABC::Field::allFields();
181 if (m_nRowPos
!= -1 && m_nRowPos
!= nAddressees
&& m_xMetaData
.is())
183 sal_Int32 nFieldNumber
= m_xMetaData
->fieldAtColumn(columnIndex
);
186 switch (nFieldNumber
)
188 case KAB_FIELD_REVISION
:
189 // trigger an exception here
193 aQtName
= aFields
[nFieldNumber
- KAB_DATA_FIELDS
]->value(m_aKabAddressees
[m_nRowPos
]);
195 // KDE address book currently does not use nullptr values.
196 // But it might do it someday
197 if (!aQtName
.isNull())
200 aRet
= OUString(reinterpret_cast<const sal_Unicode
*>(aQtName
.ucs2()));
204 // Trigger an exception ?
209 sal_Bool SAL_CALL
KabResultSet::getBoolean(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
211 ::osl::MutexGuard
aGuard( m_aMutex
);
212 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
214 ::dbtools::throwFunctionNotSupportedSQLException("getBoolean", nullptr);
219 sal_Int8 SAL_CALL
KabResultSet::getByte(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
221 ::osl::MutexGuard
aGuard( m_aMutex
);
222 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
224 ::dbtools::throwFunctionNotSupportedSQLException("getByte", nullptr);
230 sal_Int16 SAL_CALL
KabResultSet::getShort(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
232 ::osl::MutexGuard
aGuard( m_aMutex
);
233 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
235 ::dbtools::throwFunctionNotSupportedSQLException("getShort", nullptr);
241 sal_Int32 SAL_CALL
KabResultSet::getInt(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
243 ::osl::MutexGuard
aGuard( m_aMutex
);
244 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
246 ::dbtools::throwFunctionNotSupportedSQLException("getInt", nullptr);
252 sal_Int64 SAL_CALL
KabResultSet::getLong(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
254 ::osl::MutexGuard
aGuard( m_aMutex
);
255 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
257 ::dbtools::throwFunctionNotSupportedSQLException("getLong", nullptr);
262 float SAL_CALL
KabResultSet::getFloat(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
264 ::osl::MutexGuard
aGuard( m_aMutex
);
265 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
267 ::dbtools::throwFunctionNotSupportedSQLException("getFloat", nullptr);
273 double SAL_CALL
KabResultSet::getDouble(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
275 ::osl::MutexGuard
aGuard( m_aMutex
);
276 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
278 ::dbtools::throwFunctionNotSupportedSQLException("getDouble", nullptr);
284 Sequence
< sal_Int8
> SAL_CALL
KabResultSet::getBytes(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
286 ::osl::MutexGuard
aGuard( m_aMutex
);
287 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
289 ::dbtools::throwFunctionNotSupportedSQLException("", nullptr);
291 return Sequence
< sal_Int8
>();
294 cssu::Date SAL_CALL
KabResultSet::getDate(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
296 ::osl::MutexGuard
aGuard( m_aMutex
);
297 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
299 ::dbtools::throwFunctionNotSupportedSQLException("getDate", nullptr);
305 cssu::Time SAL_CALL
KabResultSet::getTime(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
307 ::osl::MutexGuard
aGuard( m_aMutex
);
308 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
310 ::dbtools::throwFunctionNotSupportedSQLException("getTime", nullptr);
316 cssu::DateTime SAL_CALL
KabResultSet::getTimestamp(sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
, std::exception
)
318 ::osl::MutexGuard
aGuard( m_aMutex
);
319 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
322 sal_Int32 nAddressees
= m_aKabAddressees
.size();
324 if (m_nRowPos
!= -1 && m_nRowPos
!= nAddressees
&& m_xMetaData
.is())
326 sal_Int32 nFieldNumber
= m_xMetaData
->fieldAtColumn(columnIndex
);
328 if (nFieldNumber
== KAB_FIELD_REVISION
)
330 QDateTime
nRevision(m_aKabAddressees
[m_nRowPos
].revision());
332 if (!nRevision
.isNull())
335 nRet
.Year
= nRevision
.date().year();
336 nRet
.Month
= nRevision
.date().month();
337 nRet
.Day
= nRevision
.date().day();
338 nRet
.Hours
= nRevision
.time().hour();
339 nRet
.Minutes
= nRevision
.time().minute();
340 nRet
.Seconds
= nRevision
.time().second();
341 nRet
.NanoSeconds
= nRevision
.time().msec() * ::tools::Time::nanoPerMilli
;
348 // trigger an exception here
350 // Trigger an exception ?
355 Reference
< XInputStream
> SAL_CALL
KabResultSet::getBinaryStream(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
357 ::osl::MutexGuard
aGuard( m_aMutex
);
358 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
360 ::dbtools::throwFunctionNotSupportedSQLException("getBinaryStream", nullptr);
365 Reference
< XInputStream
> SAL_CALL
KabResultSet::getCharacterStream(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
367 ::osl::MutexGuard
aGuard( m_aMutex
);
368 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
370 ::dbtools::throwFunctionNotSupportedSQLException("getCharacterStream", nullptr);
375 Any SAL_CALL
KabResultSet::getObject(sal_Int32
, const Reference
< css::container::XNameAccess
>&) throw(SQLException
, RuntimeException
, std::exception
)
377 ::osl::MutexGuard
aGuard( m_aMutex
);
378 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
380 ::dbtools::throwFunctionNotSupportedSQLException("getObject", nullptr);
385 Reference
< XRef
> SAL_CALL
KabResultSet::getRef(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
387 ::osl::MutexGuard
aGuard( m_aMutex
);
388 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
390 ::dbtools::throwFunctionNotSupportedSQLException("getRef", nullptr);
395 Reference
< XBlob
> SAL_CALL
KabResultSet::getBlob(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
397 ::osl::MutexGuard
aGuard( m_aMutex
);
398 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
400 ::dbtools::throwFunctionNotSupportedSQLException("getBlob", nullptr);
405 Reference
< XClob
> SAL_CALL
KabResultSet::getClob(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
407 ::osl::MutexGuard
aGuard( m_aMutex
);
408 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
410 ::dbtools::throwFunctionNotSupportedSQLException("getClob", nullptr);
415 Reference
< XArray
> SAL_CALL
KabResultSet::getArray(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
417 ::osl::MutexGuard
aGuard( m_aMutex
);
418 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
420 ::dbtools::throwFunctionNotSupportedSQLException("getArray", nullptr);
425 Reference
< XResultSetMetaData
> SAL_CALL
KabResultSet::getMetaData() throw(SQLException
, RuntimeException
, std::exception
)
427 ::osl::MutexGuard
aGuard( m_aMutex
);
428 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
430 if (!m_xMetaData
.is())
431 m_xMetaData
= new KabResultSetMetaData
;
433 Reference
< XResultSetMetaData
> xMetaData
= m_xMetaData
.get();
437 sal_Bool SAL_CALL
KabResultSet::isBeforeFirst() throw(SQLException
, RuntimeException
, std::exception
)
439 ::osl::MutexGuard
aGuard( m_aMutex
);
440 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
448 sal_Bool SAL_CALL
KabResultSet::isAfterLast() throw(SQLException
, RuntimeException
, std::exception
)
450 ::osl::MutexGuard
aGuard( m_aMutex
);
451 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
453 sal_Int32 nAddressees
= m_aKabAddressees
.size();
454 if (m_nRowPos
== nAddressees
)
460 sal_Bool SAL_CALL
KabResultSet::isFirst() throw(SQLException
, RuntimeException
, std::exception
)
462 ::osl::MutexGuard
aGuard( m_aMutex
);
463 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
471 sal_Bool SAL_CALL
KabResultSet::isLast() throw(SQLException
, RuntimeException
, std::exception
)
473 ::osl::MutexGuard
aGuard( m_aMutex
);
474 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
476 sal_Int32 nAddressees
= m_aKabAddressees
.size();
477 if (m_nRowPos
== nAddressees
- 1)
483 void SAL_CALL
KabResultSet::beforeFirst() throw(SQLException
, RuntimeException
, std::exception
)
485 ::osl::MutexGuard
aGuard( m_aMutex
);
486 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
488 // move before the first row
492 void SAL_CALL
KabResultSet::afterLast() throw(SQLException
, RuntimeException
, std::exception
)
494 ::osl::MutexGuard
aGuard( m_aMutex
);
495 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
497 // move after the last row
498 sal_Int32 nAddressees
= m_aKabAddressees
.size();
499 m_nRowPos
= nAddressees
;
502 void SAL_CALL
KabResultSet::close() throw(SQLException
, RuntimeException
, std::exception
)
505 ::osl::MutexGuard
aGuard( m_aMutex
);
506 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
511 sal_Bool SAL_CALL
KabResultSet::first() throw(SQLException
, RuntimeException
, std::exception
)
513 ::osl::MutexGuard
aGuard( m_aMutex
);
514 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
516 sal_Int32 nAddressees
= m_aKabAddressees
.size();
517 if (nAddressees
== 0)
524 sal_Bool SAL_CALL
KabResultSet::last() throw(SQLException
, RuntimeException
, std::exception
)
526 ::osl::MutexGuard
aGuard( m_aMutex
);
527 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
529 sal_Int32 nAddressees
= m_aKabAddressees
.size();
530 if (nAddressees
== 0)
533 m_nRowPos
= nAddressees
- 1;
537 sal_Int32 SAL_CALL
KabResultSet::getRow() throw(SQLException
, RuntimeException
, std::exception
)
539 ::osl::MutexGuard
aGuard( m_aMutex
);
540 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
545 sal_Bool SAL_CALL
KabResultSet::absolute(sal_Int32 row
) throw(SQLException
, RuntimeException
, std::exception
)
547 ::osl::MutexGuard
aGuard( m_aMutex
);
548 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
550 sal_Int32 nAddressees
= m_aKabAddressees
.size();
559 sal_Bool SAL_CALL
KabResultSet::relative(sal_Int32 row
) throw(SQLException
, RuntimeException
, std::exception
)
561 ::osl::MutexGuard
aGuard( m_aMutex
);
562 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
564 return absolute(m_nRowPos
+ row
);
567 sal_Bool SAL_CALL
KabResultSet::next() throw(SQLException
, RuntimeException
, std::exception
)
569 ::osl::MutexGuard
aGuard( m_aMutex
);
570 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
572 return absolute(m_nRowPos
+ 1);
575 sal_Bool SAL_CALL
KabResultSet::previous() throw(SQLException
, RuntimeException
, std::exception
)
577 ::osl::MutexGuard
aGuard( m_aMutex
);
578 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
580 return absolute(m_nRowPos
- 1);
583 Reference
< XInterface
> SAL_CALL
KabResultSet::getStatement() throw(SQLException
, RuntimeException
, std::exception
)
585 ::osl::MutexGuard
aGuard( m_aMutex
);
586 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
588 Reference
< XStatement
> xStatement
= m_xStatement
.get();
592 sal_Bool SAL_CALL
KabResultSet::rowDeleted() throw(SQLException
, RuntimeException
, std::exception
)
594 ::osl::MutexGuard
aGuard( m_aMutex
);
595 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
600 sal_Bool SAL_CALL
KabResultSet::rowInserted() throw(SQLException
, RuntimeException
, std::exception
)
602 ::osl::MutexGuard
aGuard( m_aMutex
);
603 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
608 sal_Bool SAL_CALL
KabResultSet::rowUpdated() throw(SQLException
, RuntimeException
, std::exception
)
610 ::osl::MutexGuard
aGuard( m_aMutex
);
611 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
616 sal_Bool SAL_CALL
KabResultSet::wasNull() throw(SQLException
, RuntimeException
, std::exception
)
618 ::osl::MutexGuard
aGuard( m_aMutex
);
619 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
624 void SAL_CALL
KabResultSet::cancel() throw(RuntimeException
, std::exception
)
626 ::osl::MutexGuard
aGuard( m_aMutex
);
627 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
630 void SAL_CALL
KabResultSet::clearWarnings() throw(SQLException
, RuntimeException
, std::exception
)
634 Any SAL_CALL
KabResultSet::getWarnings() throw(SQLException
, RuntimeException
, std::exception
)
639 void SAL_CALL
KabResultSet::insertRow() throw(SQLException
, RuntimeException
, std::exception
)
641 ::osl::MutexGuard
aGuard( m_aMutex
);
642 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
644 // you only have to implement this if you want to insert new rows
647 void SAL_CALL
KabResultSet::updateRow() throw(SQLException
, RuntimeException
, std::exception
)
649 ::osl::MutexGuard
aGuard( m_aMutex
);
650 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
652 // only when you allow updates
655 void SAL_CALL
KabResultSet::deleteRow() throw(SQLException
, RuntimeException
, std::exception
)
657 ::osl::MutexGuard
aGuard( m_aMutex
);
658 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
661 void SAL_CALL
KabResultSet::cancelRowUpdates() throw(SQLException
, RuntimeException
, std::exception
)
663 ::osl::MutexGuard
aGuard( m_aMutex
);
664 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
667 void SAL_CALL
KabResultSet::moveToInsertRow() throw(SQLException
, RuntimeException
, std::exception
)
669 ::osl::MutexGuard
aGuard( m_aMutex
);
670 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
672 // only when you allow inserts
675 void SAL_CALL
KabResultSet::moveToCurrentRow() throw(SQLException
, RuntimeException
, std::exception
)
677 ::osl::MutexGuard
aGuard( m_aMutex
);
678 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
681 void SAL_CALL
KabResultSet::updateNull(sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
683 ::osl::MutexGuard
aGuard( m_aMutex
);
684 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
687 void SAL_CALL
KabResultSet::updateBoolean(sal_Int32
, sal_Bool
) throw(SQLException
, RuntimeException
, std::exception
)
689 ::osl::MutexGuard
aGuard( m_aMutex
);
690 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
693 void SAL_CALL
KabResultSet::updateByte(sal_Int32
, sal_Int8
) throw(SQLException
, RuntimeException
, std::exception
)
695 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
696 ::osl::MutexGuard
aGuard( m_aMutex
);
699 void SAL_CALL
KabResultSet::updateShort(sal_Int32
, sal_Int16
) throw(SQLException
, RuntimeException
, std::exception
)
701 ::osl::MutexGuard
aGuard( m_aMutex
);
702 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
705 void SAL_CALL
KabResultSet::updateInt(sal_Int32
, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
707 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
708 ::osl::MutexGuard
aGuard( m_aMutex
);
711 void SAL_CALL
KabResultSet::updateLong(sal_Int32
, sal_Int64
) throw(SQLException
, RuntimeException
, std::exception
)
713 ::osl::MutexGuard
aGuard( m_aMutex
);
714 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
717 void SAL_CALL
KabResultSet::updateFloat(sal_Int32
, float) throw(SQLException
, RuntimeException
, std::exception
)
719 ::osl::MutexGuard
aGuard( m_aMutex
);
720 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
723 void SAL_CALL
KabResultSet::updateDouble(sal_Int32
, double) throw(SQLException
, RuntimeException
, std::exception
)
725 ::osl::MutexGuard
aGuard( m_aMutex
);
726 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
729 void SAL_CALL
KabResultSet::updateString(sal_Int32
, const OUString
&) throw(SQLException
, RuntimeException
, std::exception
)
731 ::osl::MutexGuard
aGuard( m_aMutex
);
732 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
735 void SAL_CALL
KabResultSet::updateBytes(sal_Int32
, const Sequence
< sal_Int8
>&) throw(SQLException
, RuntimeException
, std::exception
)
737 ::osl::MutexGuard
aGuard( m_aMutex
);
738 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
741 void SAL_CALL
KabResultSet::updateDate(sal_Int32
, const cssu::Date
&) throw(SQLException
, RuntimeException
, std::exception
)
743 ::osl::MutexGuard
aGuard( m_aMutex
);
744 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
747 void SAL_CALL
KabResultSet::updateTime(sal_Int32
, const cssu::Time
&) throw(SQLException
, RuntimeException
, std::exception
)
749 ::osl::MutexGuard
aGuard( m_aMutex
);
750 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
753 void SAL_CALL
KabResultSet::updateTimestamp(sal_Int32
, const cssu::DateTime
&) throw(SQLException
, RuntimeException
, std::exception
)
755 ::osl::MutexGuard
aGuard( m_aMutex
);
756 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
759 void SAL_CALL
KabResultSet::updateBinaryStream(sal_Int32
, const Reference
< XInputStream
>&, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
761 ::osl::MutexGuard
aGuard( m_aMutex
);
762 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
765 void SAL_CALL
KabResultSet::updateCharacterStream(sal_Int32
, const Reference
< XInputStream
>&, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
767 ::osl::MutexGuard
aGuard( m_aMutex
);
768 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
771 void SAL_CALL
KabResultSet::refreshRow() throw(SQLException
, RuntimeException
, std::exception
)
773 ::osl::MutexGuard
aGuard( m_aMutex
);
774 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
777 void SAL_CALL
KabResultSet::updateObject(sal_Int32
, const Any
&) throw(SQLException
, RuntimeException
, std::exception
)
779 ::osl::MutexGuard
aGuard( m_aMutex
);
780 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
783 void SAL_CALL
KabResultSet::updateNumericObject(sal_Int32
, const Any
&, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
785 ::osl::MutexGuard
aGuard( m_aMutex
);
786 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
790 Any SAL_CALL
KabResultSet::getBookmark() throw( SQLException
, RuntimeException
, std::exception
)
792 ::osl::MutexGuard
aGuard( m_aMutex
);
793 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
795 sal_Int32 nAddressees
= m_aKabAddressees
.size();
797 if (m_nRowPos
!= -1 && m_nRowPos
!= nAddressees
)
799 QString aQtName
= m_aKabAddressees
[m_nRowPos
].uid();
800 OUString sUniqueIdentifier
= OUString(reinterpret_cast<const sal_Unicode
*>(aQtName
.ucs2()));
801 return makeAny(sUniqueIdentifier
);
806 sal_Bool SAL_CALL
KabResultSet::moveToBookmark(const Any
& bookmark
) throw( SQLException
, RuntimeException
, std::exception
)
808 ::osl::MutexGuard
aGuard( m_aMutex
);
809 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
811 OUString sBookmark
= comphelper::getString(bookmark
);
812 sal_Int32 nAddressees
= m_aKabAddressees
.size();
814 for (sal_Int32 nRow
= 0; nRow
< nAddressees
; nRow
++)
816 QString aQtName
= m_aKabAddressees
[nRow
].uid();
817 OUString sUniqueIdentifier
= OUString(reinterpret_cast<const sal_Unicode
*>(aQtName
.ucs2()));
819 if (sUniqueIdentifier
== sBookmark
)
828 sal_Bool SAL_CALL
KabResultSet::moveRelativeToBookmark(const Any
& bookmark
, sal_Int32 rows
) throw( SQLException
, RuntimeException
, std::exception
)
830 ::osl::MutexGuard
aGuard( m_aMutex
);
831 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
833 sal_Int32 nRowSave
= m_nRowPos
;
835 if (moveToBookmark(bookmark
))
837 sal_Int32 nAddressees
= m_aKabAddressees
.size();
841 if (-1 < m_nRowPos
&& m_nRowPos
< nAddressees
)
845 m_nRowPos
= nRowSave
;
849 sal_Int32 SAL_CALL
KabResultSet::compareBookmarks(const Any
& firstItem
, const Any
& secondItem
) throw( SQLException
, RuntimeException
, std::exception
)
851 ::osl::MutexGuard
aGuard( m_aMutex
);
852 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
854 OUString sFirst
= comphelper::getString(firstItem
);
855 OUString sSecond
= comphelper::getString(secondItem
);
857 if (sFirst
< sSecond
)
858 return CompareBookmark::LESS
;
859 if (sFirst
> sSecond
)
860 return CompareBookmark::GREATER
;
861 return CompareBookmark::EQUAL
;
864 sal_Bool SAL_CALL
KabResultSet::hasOrderedBookmarks() throw( SQLException
, RuntimeException
, std::exception
)
869 sal_Int32 SAL_CALL
KabResultSet::hashBookmark(const Any
& bookmark
) throw( SQLException
, RuntimeException
, std::exception
)
871 ::osl::MutexGuard
aGuard( m_aMutex
);
872 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
874 OUString sBookmark
= comphelper::getString(bookmark
);
876 return sBookmark
.hashCode();
880 Sequence
< sal_Int32
> SAL_CALL
KabResultSet::deleteRows(const Sequence
< Any
>&) throw( SQLException
, RuntimeException
, std::exception
)
882 ::osl::MutexGuard
aGuard( m_aMutex
);
883 checkDisposed(KabResultSet_BASE::rBHelper
.bDisposed
);
885 return Sequence
< sal_Int32
>();
888 IPropertyArrayHelper
* KabResultSet::createArrayHelper() const
890 Sequence
< Property
> aProps(6);
891 Property
* pProperties
= aProps
.getArray();
893 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME
),
894 PROPERTY_ID_CURSORNAME
, cppu::UnoType
<OUString
>::get(), PropertyAttribute::READONLY
);
896 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION
),
897 PROPERTY_ID_FETCHDIRECTION
, cppu::UnoType
<sal_Int32
>::get(), 0);
899 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE
),
900 PROPERTY_ID_FETCHSIZE
, cppu::UnoType
<sal_Int32
>::get(), 0);
902 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE
),
903 PROPERTY_ID_ISBOOKMARKABLE
, cppu::UnoType
<bool>::get(), PropertyAttribute::READONLY
);
905 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY
),
906 PROPERTY_ID_RESULTSETCONCURRENCY
, cppu::UnoType
<sal_Int32
>::get(), PropertyAttribute::READONLY
);
908 pProperties
[nPos
++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE
),
909 PROPERTY_ID_RESULTSETTYPE
, cppu::UnoType
<sal_Int32
>::get(), PropertyAttribute::READONLY
);
911 return new OPropertyArrayHelper(aProps
);
914 IPropertyArrayHelper
& KabResultSet::getInfoHelper()
916 return *(this->getArrayHelper());
919 sal_Bool
KabResultSet::convertFastPropertyValue(
924 throw (css::lang::IllegalArgumentException
)
928 case PROPERTY_ID_ISBOOKMARKABLE
:
929 case PROPERTY_ID_CURSORNAME
:
930 case PROPERTY_ID_RESULTSETCONCURRENCY
:
931 case PROPERTY_ID_RESULTSETTYPE
:
932 throw css::lang::IllegalArgumentException();
934 case PROPERTY_ID_FETCHDIRECTION
:
935 case PROPERTY_ID_FETCHSIZE
:
942 void KabResultSet::setFastPropertyValue_NoBroadcast(
945 throw (Exception
, std::exception
)
949 case PROPERTY_ID_ISBOOKMARKABLE
:
950 case PROPERTY_ID_CURSORNAME
:
951 case PROPERTY_ID_RESULTSETCONCURRENCY
:
952 case PROPERTY_ID_RESULTSETTYPE
:
955 case PROPERTY_ID_FETCHDIRECTION
:
957 case PROPERTY_ID_FETCHSIZE
:
964 void KabResultSet::getFastPropertyValue(
966 sal_Int32 nHandle
) const
970 case PROPERTY_ID_ISBOOKMARKABLE
:
973 case PROPERTY_ID_CURSORNAME
:
974 case PROPERTY_ID_RESULTSETCONCURRENCY
:
975 case PROPERTY_ID_RESULTSETTYPE
:
976 case PROPERTY_ID_FETCHDIRECTION
:
977 case PROPERTY_ID_FETCHSIZE
:
983 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */