1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "KResultSet.hxx" 32*cdf0e10cSrcweir #include "KResultSetMetaData.hxx" 33*cdf0e10cSrcweir #include "KConnection.hxx" 34*cdf0e10cSrcweir #include "kcondition.hxx" 35*cdf0e10cSrcweir #include "korder.hxx" 36*cdf0e10cSrcweir #include "kfields.hxx" 37*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/sdbcx/CompareBookmark.hpp> 39*cdf0e10cSrcweir #include "TConnection.hxx" 40*cdf0e10cSrcweir #include <connectivity/dbexception.hxx> 41*cdf0e10cSrcweir #include "resource/kab_res.hrc" 42*cdf0e10cSrcweir #include "resource/sharedresources.hxx" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace connectivity::kab; 45*cdf0e10cSrcweir using namespace cppu; 46*cdf0e10cSrcweir using namespace com::sun::star::uno; 47*cdf0e10cSrcweir using namespace com::sun::star::lang; 48*cdf0e10cSrcweir using namespace com::sun::star::beans; 49*cdf0e10cSrcweir using namespace com::sun::star::sdbc; 50*cdf0e10cSrcweir using namespace com::sun::star::sdbcx; 51*cdf0e10cSrcweir using namespace com::sun::star::io; 52*cdf0e10cSrcweir using namespace com::sun::star::util; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO(KabResultSet, "com.sun.star.sdbc.drivers.KabResultSet", "com.sun.star.sdbc.ResultSet"); 55*cdf0e10cSrcweir // ------------------------------------------------------------------------- 56*cdf0e10cSrcweir KabResultSet::KabResultSet(KabCommonStatement* pStmt) 57*cdf0e10cSrcweir : KabResultSet_BASE(m_aMutex), 58*cdf0e10cSrcweir OPropertySetHelper(KabResultSet_BASE::rBHelper), 59*cdf0e10cSrcweir m_xStatement(pStmt), 60*cdf0e10cSrcweir m_xMetaData(NULL), 61*cdf0e10cSrcweir m_aKabAddressees(), 62*cdf0e10cSrcweir m_nRowPos(-1), 63*cdf0e10cSrcweir m_bWasNull(sal_True) 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir } 66*cdf0e10cSrcweir // ------------------------------------------------------------------------- 67*cdf0e10cSrcweir KabResultSet::~KabResultSet() 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir } 70*cdf0e10cSrcweir // ------------------------------------------------------------------------- 71*cdf0e10cSrcweir void KabResultSet::allKabAddressees() 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get()); 74*cdf0e10cSrcweir KABC::AddressBook* pAddressBook = pConnection->getAddressBook(); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir m_aKabAddressees = pAddressBook->allAddressees(); 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir // ------------------------------------------------------------------------- 79*cdf0e10cSrcweir void KabResultSet::someKabAddressees(const KabCondition *pCondition) 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get()); 82*cdf0e10cSrcweir KABC::AddressBook* pAddressBook = pConnection->getAddressBook(); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir KABC::AddressBook::Iterator iterator; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir for (iterator = pAddressBook->begin(); 87*cdf0e10cSrcweir iterator != pAddressBook->end(); 88*cdf0e10cSrcweir ++iterator) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir if (pCondition->eval(*iterator)) 91*cdf0e10cSrcweir m_aKabAddressees.push_back(*iterator); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir // ------------------------------------------------------------------------- 95*cdf0e10cSrcweir void KabResultSet::sortKabAddressees(const KabOrder *pOrder) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir // We do not use class KAddresseeList, which has a sorting algorithm in it, because 98*cdf0e10cSrcweir // it uses templates. It would expand to more or less the same code as the one 99*cdf0e10cSrcweir // which follows, but it would need not be called in a much less convenient way. 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir KABC::Addressee::List::Iterator 102*cdf0e10cSrcweir begin = m_aKabAddressees.begin(), 103*cdf0e10cSrcweir end = m_aKabAddressees.end(), 104*cdf0e10cSrcweir iterator; 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir // Bubble sort. Feel free to implement a better algorithm. 107*cdf0e10cSrcweir while (begin != end) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir end--; 110*cdf0e10cSrcweir for (iterator = begin; iterator != end; ++iterator) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir if (pOrder->compare(*iterator, *end) > 0) 113*cdf0e10cSrcweir qSwap(*iterator, *end); 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir // ------------------------------------------------------------------------- 118*cdf0e10cSrcweir void KabResultSet::disposing() 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir OPropertySetHelper::disposing(); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir m_xStatement.clear(); 125*cdf0e10cSrcweir m_xMetaData.clear(); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir // ------------------------------------------------------------------------- 128*cdf0e10cSrcweir Any SAL_CALL KabResultSet::queryInterface(const Type & rType) throw(RuntimeException) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir Any aRet = OPropertySetHelper::queryInterface(rType); 131*cdf0e10cSrcweir if (!aRet.hasValue()) 132*cdf0e10cSrcweir aRet = KabResultSet_BASE::queryInterface(rType); 133*cdf0e10cSrcweir return aRet; 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir // ------------------------------------------------------------------------- 136*cdf0e10cSrcweir void SAL_CALL KabResultSet::acquire() throw() 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir KabResultSet_BASE::acquire(); 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir // ------------------------------------------------------------------------- 141*cdf0e10cSrcweir void SAL_CALL KabResultSet::release() throw() 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir KabResultSet_BASE::release(); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir // ------------------------------------------------------------------------- 146*cdf0e10cSrcweir Sequence< Type > SAL_CALL KabResultSet::getTypes() throw(RuntimeException) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir OTypeCollection aTypes( 149*cdf0e10cSrcweir ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet >*) 0), 150*cdf0e10cSrcweir ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet >*) 0), 151*cdf0e10cSrcweir ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet >*) 0)); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir return comphelper::concatSequences(aTypes.getTypes(), KabResultSet_BASE::getTypes()); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir // ------------------------------------------------------------------------- 156*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir // ------------------------------------------------------------------------- 161*cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::findColumn(const ::rtl::OUString& columnName) throw(SQLException, RuntimeException) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 164*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // find the first column with the name columnName 167*cdf0e10cSrcweir Reference< XResultSetMetaData > xMeta = getMetaData(); 168*cdf0e10cSrcweir sal_Int32 nLen = xMeta->getColumnCount(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir for (sal_Int32 i = 1; i <= nLen; ++i) 171*cdf0e10cSrcweir if (xMeta->isCaseSensitive(i) ? 172*cdf0e10cSrcweir columnName == xMeta->getColumnName(i) : 173*cdf0e10cSrcweir columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) 174*cdf0e10cSrcweir return i; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir ::connectivity::SharedResources aResources; 177*cdf0e10cSrcweir const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( 178*cdf0e10cSrcweir STR_INVALID_COLUMNNAME, 179*cdf0e10cSrcweir "$columnname$",columnName 180*cdf0e10cSrcweir ) ); 181*cdf0e10cSrcweir ::dbtools::throwGenericSQLException(sError,NULL); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // Unreachable: 184*cdf0e10cSrcweir OSL_ASSERT(false); 185*cdf0e10cSrcweir return 0; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir // ------------------------------------------------------------------------- 188*cdf0e10cSrcweir ::rtl::OUString SAL_CALL KabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 191*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir ::rtl::OUString aRet; 194*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 195*cdf0e10cSrcweir ::KABC::Field::List aFields = ::KABC::Field::allFields(); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is()) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex); 200*cdf0e10cSrcweir QString aQtName; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir switch (nFieldNumber) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir case KAB_FIELD_REVISION: 205*cdf0e10cSrcweir // trigger an exception here 206*cdf0e10cSrcweir m_bWasNull = true; 207*cdf0e10cSrcweir return aRet; 208*cdf0e10cSrcweir default: 209*cdf0e10cSrcweir aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->value(m_aKabAddressees[m_nRowPos]); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir // KDE address book currently does not use NULL values. 212*cdf0e10cSrcweir // But it might do it someday 213*cdf0e10cSrcweir if (!aQtName.isNull()) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir m_bWasNull = false; 216*cdf0e10cSrcweir aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2()); 217*cdf0e10cSrcweir return aRet; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir // Trigger an exception ? 221*cdf0e10cSrcweir m_bWasNull = true; 222*cdf0e10cSrcweir return aRet; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir // ------------------------------------------------------------------------- 225*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::getBoolean(sal_Int32) throw(SQLException, RuntimeException) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 228*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBoolean", NULL); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir return sal_False; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir // ------------------------------------------------------------------------- 235*cdf0e10cSrcweir sal_Int8 SAL_CALL KabResultSet::getByte(sal_Int32) throw(SQLException, RuntimeException) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 238*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getByte", NULL); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir sal_Int8 nRet = 0; 243*cdf0e10cSrcweir return nRet; 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir // ------------------------------------------------------------------------- 246*cdf0e10cSrcweir sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32) throw(SQLException, RuntimeException) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 249*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getShort", NULL); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir sal_Int16 nRet = 0; 254*cdf0e10cSrcweir return nRet; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir // ------------------------------------------------------------------------- 257*cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32) throw(SQLException, RuntimeException) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 260*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getInt", NULL); 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir sal_Int32 nRet = 0; 265*cdf0e10cSrcweir return nRet; 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir // ------------------------------------------------------------------------- 268*cdf0e10cSrcweir sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32) throw(SQLException, RuntimeException) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 271*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getLong", NULL); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir return sal_Int64(); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir // ------------------------------------------------------------------------- 278*cdf0e10cSrcweir float SAL_CALL KabResultSet::getFloat(sal_Int32) throw(SQLException, RuntimeException) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 281*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getFloat", NULL); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir float nVal(0); 286*cdf0e10cSrcweir return nVal; 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir // ------------------------------------------------------------------------- 289*cdf0e10cSrcweir double SAL_CALL KabResultSet::getDouble(sal_Int32) throw(SQLException, RuntimeException) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 292*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getDouble", NULL); 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir double nRet = 0; 297*cdf0e10cSrcweir return nRet; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir // ------------------------------------------------------------------------- 300*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32) throw(SQLException, RuntimeException) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 303*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("", NULL); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir return Sequence< sal_Int8 >(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir // ------------------------------------------------------------------------- 310*cdf0e10cSrcweir Date SAL_CALL KabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeException) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 313*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getDate", NULL); 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir Date aRet; 318*cdf0e10cSrcweir return aRet; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir // ------------------------------------------------------------------------- 321*cdf0e10cSrcweir Time SAL_CALL KabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeException) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 324*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getTime", NULL); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir Time nRet; 329*cdf0e10cSrcweir return nRet; 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir // ------------------------------------------------------------------------- 332*cdf0e10cSrcweir DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 335*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir DateTime nRet; 338*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is()) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir KabResultSetMetaData *pMeta = static_cast<KabResultSetMetaData *>(m_xMetaData.get()); 343*cdf0e10cSrcweir sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir if (nFieldNumber == KAB_FIELD_REVISION) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir QDateTime nRevision(m_aKabAddressees[m_nRowPos].revision()); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir if (!nRevision.isNull()) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir m_bWasNull = false; 352*cdf0e10cSrcweir nRet.Year = nRevision.date().year(); 353*cdf0e10cSrcweir nRet.Month = nRevision.date().month(); 354*cdf0e10cSrcweir nRet.Day = nRevision.date().day(); 355*cdf0e10cSrcweir nRet.Hours = nRevision.time().hour(); 356*cdf0e10cSrcweir nRet.Minutes = nRevision.time().minute(); 357*cdf0e10cSrcweir nRet.Seconds = nRevision.time().second(); 358*cdf0e10cSrcweir nRet.HundredthSeconds = nRevision.time().msec() / 10; 359*cdf0e10cSrcweir return nRet; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir else { 363*cdf0e10cSrcweir ; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir // trigger an exception here 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir // Trigger an exception ? 368*cdf0e10cSrcweir m_bWasNull = true; 369*cdf0e10cSrcweir return nRet; 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir // ------------------------------------------------------------------------- 372*cdf0e10cSrcweir Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32) throw(SQLException, RuntimeException) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 375*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir return NULL; 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir // ------------------------------------------------------------------------- 382*cdf0e10cSrcweir Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32) throw(SQLException, RuntimeException) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 385*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir return NULL; 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir // ------------------------------------------------------------------------- 392*cdf0e10cSrcweir Any SAL_CALL KabResultSet::getObject(sal_Int32, const Reference< ::com::sun::star::container::XNameAccess >&) throw(SQLException, RuntimeException) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 395*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getObject", NULL); 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir return Any(); 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir // ------------------------------------------------------------------------- 402*cdf0e10cSrcweir Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32) throw(SQLException, RuntimeException) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 405*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getRef", NULL); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir return NULL; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir // ------------------------------------------------------------------------- 412*cdf0e10cSrcweir Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32) throw(SQLException, RuntimeException) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 415*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBlob", NULL); 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir return NULL; 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir // ------------------------------------------------------------------------- 422*cdf0e10cSrcweir Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32) throw(SQLException, RuntimeException) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 425*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getClob", NULL); 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir return NULL; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir // ------------------------------------------------------------------------- 432*cdf0e10cSrcweir Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32) throw(SQLException, RuntimeException) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 435*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getArray", NULL); 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir return NULL; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir // ------------------------------------------------------------------------- 442*cdf0e10cSrcweir Reference< XResultSetMetaData > SAL_CALL KabResultSet::getMetaData() throw(SQLException, RuntimeException) 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 445*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir if (!m_xMetaData.is()) 448*cdf0e10cSrcweir m_xMetaData = new KabResultSetMetaData(m_xStatement->getOwnConnection()); 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir Reference< XResultSetMetaData > xMetaData = m_xMetaData.get(); 451*cdf0e10cSrcweir return xMetaData; 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir // ------------------------------------------------------------------------- 454*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isBeforeFirst() throw(SQLException, RuntimeException) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 457*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir if (m_nRowPos == -1) 460*cdf0e10cSrcweir return sal_True; 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir return sal_False; 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir // ------------------------------------------------------------------------- 465*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isAfterLast() throw(SQLException, RuntimeException) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 468*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 471*cdf0e10cSrcweir if (m_nRowPos == nAddressees) 472*cdf0e10cSrcweir return sal_True; 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir return sal_False; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir // ------------------------------------------------------------------------- 477*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isFirst() throw(SQLException, RuntimeException) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 480*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir if (m_nRowPos == 0) 483*cdf0e10cSrcweir return sal_True; 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir return sal_False; 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir // ------------------------------------------------------------------------- 488*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isLast() throw(SQLException, RuntimeException) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 491*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 494*cdf0e10cSrcweir if (m_nRowPos == nAddressees - 1) 495*cdf0e10cSrcweir return sal_True; 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir return sal_False; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir // ------------------------------------------------------------------------- 500*cdf0e10cSrcweir void SAL_CALL KabResultSet::beforeFirst() throw(SQLException, RuntimeException) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 503*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir // move before the first row 506*cdf0e10cSrcweir m_nRowPos = -1; 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir // ------------------------------------------------------------------------- 509*cdf0e10cSrcweir void SAL_CALL KabResultSet::afterLast() throw(SQLException, RuntimeException) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 512*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir // move after the last row 515*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 516*cdf0e10cSrcweir m_nRowPos = nAddressees; 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir // ------------------------------------------------------------------------- 519*cdf0e10cSrcweir void SAL_CALL KabResultSet::close() throw(SQLException, RuntimeException) 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 523*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir dispose(); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir // ------------------------------------------------------------------------- 528*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::first() throw(SQLException, RuntimeException) 529*cdf0e10cSrcweir { 530*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 531*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 534*cdf0e10cSrcweir if (nAddressees == 0) 535*cdf0e10cSrcweir return sal_False; 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir m_nRowPos = 0; 538*cdf0e10cSrcweir return sal_True; 539*cdf0e10cSrcweir } 540*cdf0e10cSrcweir // ------------------------------------------------------------------------- 541*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::last() throw(SQLException, RuntimeException) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 544*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 547*cdf0e10cSrcweir if (nAddressees == 0) 548*cdf0e10cSrcweir return sal_False; 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir m_nRowPos = nAddressees - 1; 551*cdf0e10cSrcweir return sal_True; 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir // ------------------------------------------------------------------------- 554*cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::getRow() throw(SQLException, RuntimeException) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 557*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir return m_nRowPos; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir // ------------------------------------------------------------------------- 562*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::absolute(sal_Int32 row) throw(SQLException, RuntimeException) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 565*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 568*cdf0e10cSrcweir if (row <= -1 || 569*cdf0e10cSrcweir row >= nAddressees) 570*cdf0e10cSrcweir return sal_False; 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir m_nRowPos = row; 573*cdf0e10cSrcweir return sal_True; 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir // ------------------------------------------------------------------------- 576*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::relative(sal_Int32 row) throw(SQLException, RuntimeException) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 579*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir return absolute(m_nRowPos + row); 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir // ------------------------------------------------------------------------- 584*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::next() throw(SQLException, RuntimeException) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 587*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir return absolute(m_nRowPos + 1); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir // ------------------------------------------------------------------------- 592*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::previous() throw(SQLException, RuntimeException) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 595*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir return absolute(m_nRowPos - 1); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir // ------------------------------------------------------------------------- 600*cdf0e10cSrcweir Reference< XInterface > SAL_CALL KabResultSet::getStatement() throw(SQLException, RuntimeException) 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 603*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir Reference< XStatement > xStatement = m_xStatement.get(); 606*cdf0e10cSrcweir return xStatement; 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir // ------------------------------------------------------------------------- 609*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowDeleted() throw(SQLException, RuntimeException) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 612*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir return sal_False; 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir // ------------------------------------------------------------------------- 617*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowInserted() throw(SQLException, RuntimeException) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 620*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir return sal_False; 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir // ------------------------------------------------------------------------- 625*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowUpdated() throw(SQLException, RuntimeException) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 628*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir return sal_False; 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir // ------------------------------------------------------------------------- 633*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::wasNull() throw(SQLException, RuntimeException) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 636*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir return m_bWasNull; 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir // ------------------------------------------------------------------------- 641*cdf0e10cSrcweir void SAL_CALL KabResultSet::cancel() throw(RuntimeException) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 644*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir // ------------------------------------------------------------------------- 647*cdf0e10cSrcweir void SAL_CALL KabResultSet::clearWarnings() throw(SQLException, RuntimeException) 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir // ------------------------------------------------------------------------- 651*cdf0e10cSrcweir Any SAL_CALL KabResultSet::getWarnings() throw(SQLException, RuntimeException) 652*cdf0e10cSrcweir { 653*cdf0e10cSrcweir return Any(); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir // ------------------------------------------------------------------------- 656*cdf0e10cSrcweir void SAL_CALL KabResultSet::insertRow() throw(SQLException, RuntimeException) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 659*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 660*cdf0e10cSrcweir 661*cdf0e10cSrcweir // you only have to implement this if you want to insert new rows 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir // ------------------------------------------------------------------------- 664*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateRow() throw(SQLException, RuntimeException) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 667*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir // only when you allow updates 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir // ------------------------------------------------------------------------- 672*cdf0e10cSrcweir void SAL_CALL KabResultSet::deleteRow() throw(SQLException, RuntimeException) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 675*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir // ------------------------------------------------------------------------- 678*cdf0e10cSrcweir void SAL_CALL KabResultSet::cancelRowUpdates() throw(SQLException, RuntimeException) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 681*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir // ------------------------------------------------------------------------- 684*cdf0e10cSrcweir void SAL_CALL KabResultSet::moveToInsertRow() throw(SQLException, RuntimeException) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 687*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir // only when you allow inserts 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir // ------------------------------------------------------------------------- 692*cdf0e10cSrcweir void SAL_CALL KabResultSet::moveToCurrentRow() throw(SQLException, RuntimeException) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 695*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir // ------------------------------------------------------------------------- 698*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateNull(sal_Int32) throw(SQLException, RuntimeException) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 701*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir // ------------------------------------------------------------------------- 704*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 707*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 708*cdf0e10cSrcweir } 709*cdf0e10cSrcweir // ------------------------------------------------------------------------- 710*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException) 711*cdf0e10cSrcweir { 712*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 713*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir // ------------------------------------------------------------------------- 716*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 719*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir // ------------------------------------------------------------------------- 722*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 725*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir // ------------------------------------------------------------------------- 728*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 731*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir // ----------------------------------------------------------------------- 734*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateFloat(sal_Int32, float) throw(SQLException, RuntimeException) 735*cdf0e10cSrcweir { 736*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 737*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir // ------------------------------------------------------------------------- 740*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateDouble(sal_Int32, double) throw(SQLException, RuntimeException) 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 743*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir // ------------------------------------------------------------------------- 746*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateString(sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 749*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir // ------------------------------------------------------------------------- 752*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 755*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir // ------------------------------------------------------------------------- 758*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateDate(sal_Int32, const Date&) throw(SQLException, RuntimeException) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 761*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir // ------------------------------------------------------------------------- 764*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateTime(sal_Int32, const Time&) throw(SQLException, RuntimeException) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 767*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir // ------------------------------------------------------------------------- 770*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException) 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 773*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir // ------------------------------------------------------------------------- 776*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBinaryStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 779*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir // ------------------------------------------------------------------------- 782*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateCharacterStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 785*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir // ------------------------------------------------------------------------- 788*cdf0e10cSrcweir void SAL_CALL KabResultSet::refreshRow() throw(SQLException, RuntimeException) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 791*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir // ------------------------------------------------------------------------- 794*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateObject(sal_Int32, const Any&) throw(SQLException, RuntimeException) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 797*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir // ------------------------------------------------------------------------- 800*cdf0e10cSrcweir void SAL_CALL KabResultSet::updateNumericObject(sal_Int32, const Any&, sal_Int32) throw(SQLException, RuntimeException) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 803*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir // ------------------------------------------------------------------------- 806*cdf0e10cSrcweir // XRowLocate 807*cdf0e10cSrcweir Any SAL_CALL KabResultSet::getBookmark() throw( SQLException, RuntimeException) 808*cdf0e10cSrcweir { 809*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 810*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir if (m_nRowPos != -1 && m_nRowPos != nAddressees) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir QString aQtName = m_aKabAddressees[m_nRowPos].uid(); 817*cdf0e10cSrcweir ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2()); 818*cdf0e10cSrcweir return makeAny(sUniqueIdentifier); 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir return Any(); 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir // ------------------------------------------------------------------------- 823*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException) 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 826*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir ::rtl::OUString sBookmark = comphelper::getString(bookmark); 829*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir for (sal_Int32 nRow = 0; nRow < nAddressees; nRow++) 832*cdf0e10cSrcweir { 833*cdf0e10cSrcweir QString aQtName = m_aKabAddressees[nRow].uid(); 834*cdf0e10cSrcweir ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2()); 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir if (sUniqueIdentifier == sBookmark) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir m_nRowPos = nRow; 839*cdf0e10cSrcweir return sal_True; 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir } 842*cdf0e10cSrcweir return sal_False; 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir // ------------------------------------------------------------------------- 845*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException) 846*cdf0e10cSrcweir { 847*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 848*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 849*cdf0e10cSrcweir 850*cdf0e10cSrcweir sal_Int32 nRowSave = m_nRowPos; 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir if (moveToBookmark(bookmark)) 853*cdf0e10cSrcweir { 854*cdf0e10cSrcweir sal_Int32 nAddressees = m_aKabAddressees.size(); 855*cdf0e10cSrcweir 856*cdf0e10cSrcweir m_nRowPos += rows; 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir if (-1 < m_nRowPos && m_nRowPos < nAddressees) 859*cdf0e10cSrcweir return sal_True; 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir m_nRowPos = nRowSave; 863*cdf0e10cSrcweir return sal_False; 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir // ------------------------------------------------------------------------- 866*cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::compareBookmarks(const Any& firstItem, const Any& secondItem) throw( SQLException, RuntimeException) 867*cdf0e10cSrcweir { 868*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 869*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir ::rtl::OUString sFirst = comphelper::getString(firstItem); 872*cdf0e10cSrcweir ::rtl::OUString sSecond = comphelper::getString(secondItem); 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir if (sFirst < sSecond) 875*cdf0e10cSrcweir return CompareBookmark::LESS; 876*cdf0e10cSrcweir if (sFirst > sSecond) 877*cdf0e10cSrcweir return CompareBookmark::GREATER; 878*cdf0e10cSrcweir return CompareBookmark::EQUAL; 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir // ------------------------------------------------------------------------- 881*cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::hasOrderedBookmarks() throw( SQLException, RuntimeException) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir return sal_False; 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir // ------------------------------------------------------------------------- 886*cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException) 887*cdf0e10cSrcweir { 888*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 889*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir ::rtl::OUString sBookmark = comphelper::getString(bookmark); 892*cdf0e10cSrcweir 893*cdf0e10cSrcweir return sBookmark.hashCode(); 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir // ------------------------------------------------------------------------- 896*cdf0e10cSrcweir // XDeleteRows 897*cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL KabResultSet::deleteRows(const Sequence< Any >&) throw( SQLException, RuntimeException) 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 900*cdf0e10cSrcweir checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir return Sequence< sal_Int32 >(); 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir // ------------------------------------------------------------------------- 905*cdf0e10cSrcweir IPropertyArrayHelper* KabResultSet::createArrayHelper() const 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir Sequence< Property > aProps(6); 908*cdf0e10cSrcweir Property* pProperties = aProps.getArray(); 909*cdf0e10cSrcweir sal_Int32 nPos = 0; 910*cdf0e10cSrcweir DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); 911*cdf0e10cSrcweir DECL_PROP0(FETCHDIRECTION, sal_Int32); 912*cdf0e10cSrcweir DECL_PROP0(FETCHSIZE, sal_Int32); 913*cdf0e10cSrcweir DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); 914*cdf0e10cSrcweir DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); 915*cdf0e10cSrcweir DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir return new OPropertyArrayHelper(aProps); 918*cdf0e10cSrcweir } 919*cdf0e10cSrcweir // ------------------------------------------------------------------------- 920*cdf0e10cSrcweir IPropertyArrayHelper & KabResultSet::getInfoHelper() 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir return *static_cast<KabResultSet*>(this)->getArrayHelper(); 923*cdf0e10cSrcweir } 924*cdf0e10cSrcweir // ------------------------------------------------------------------------- 925*cdf0e10cSrcweir sal_Bool KabResultSet::convertFastPropertyValue( 926*cdf0e10cSrcweir Any &, 927*cdf0e10cSrcweir Any &, 928*cdf0e10cSrcweir sal_Int32 nHandle, 929*cdf0e10cSrcweir const Any& ) 930*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException) 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir switch (nHandle) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir case PROPERTY_ID_ISBOOKMARKABLE: 935*cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 936*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 937*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 938*cdf0e10cSrcweir throw ::com::sun::star::lang::IllegalArgumentException(); 939*cdf0e10cSrcweir break; 940*cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 941*cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 942*cdf0e10cSrcweir default: 943*cdf0e10cSrcweir ; 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir return sal_False; 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir // ------------------------------------------------------------------------- 948*cdf0e10cSrcweir void KabResultSet::setFastPropertyValue_NoBroadcast( 949*cdf0e10cSrcweir sal_Int32 nHandle, 950*cdf0e10cSrcweir const Any& ) 951*cdf0e10cSrcweir throw (Exception) 952*cdf0e10cSrcweir { 953*cdf0e10cSrcweir switch (nHandle) 954*cdf0e10cSrcweir { 955*cdf0e10cSrcweir case PROPERTY_ID_ISBOOKMARKABLE: 956*cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 957*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 958*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 959*cdf0e10cSrcweir throw Exception(); 960*cdf0e10cSrcweir break; 961*cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 962*cdf0e10cSrcweir break; 963*cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 964*cdf0e10cSrcweir break; 965*cdf0e10cSrcweir default: 966*cdf0e10cSrcweir ; 967*cdf0e10cSrcweir } 968*cdf0e10cSrcweir } 969*cdf0e10cSrcweir // ------------------------------------------------------------------------- 970*cdf0e10cSrcweir void KabResultSet::getFastPropertyValue( 971*cdf0e10cSrcweir Any& _rValue, 972*cdf0e10cSrcweir sal_Int32 nHandle) const 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir switch (nHandle) 975*cdf0e10cSrcweir { 976*cdf0e10cSrcweir case PROPERTY_ID_ISBOOKMARKABLE: 977*cdf0e10cSrcweir _rValue <<= (sal_Bool)sal_False; 978*cdf0e10cSrcweir break; 979*cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 980*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 981*cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 982*cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 983*cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 984*cdf0e10cSrcweir ; 985*cdf0e10cSrcweir } 986*cdf0e10cSrcweir } 987*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 988