1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_connectivity.hxx" 30 #include "ado/AResultSet.hxx" 31 #include "ado/AResultSetMetaData.hxx" 32 #include <com/sun/star/sdbc/DataType.hpp> 33 #include <com/sun/star/sdbc/KeyRule.hpp> 34 #include <com/sun/star/sdbc/IndexType.hpp> 35 #include <comphelper/property.hxx> 36 #include <com/sun/star/lang/DisposedException.hpp> 37 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 38 #include <com/sun/star/sdbc/ResultSetType.hpp> 39 #include <com/sun/star/sdbc/FetchDirection.hpp> 40 #include <cppuhelper/typeprovider.hxx> 41 #include <comphelper/sequence.hxx> 42 #include <com/sun/star/beans/PropertyAttribute.hpp> 43 #include <comphelper/seqstream.hxx> 44 #include "connectivity/dbexception.hxx" 45 #include "connectivity/dbtools.hxx" 46 #include <comphelper/types.hxx> 47 48 using namespace ::comphelper; 49 50 51 #include <oledb.h> 52 53 #define CHECK_RETURN(x) \ 54 if(!SUCCEEDED(x)) \ 55 ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this); 56 57 using namespace connectivity::ado; 58 using namespace com::sun::star::uno; 59 using namespace com::sun::star::lang; 60 using namespace com::sun::star::beans; 61 using namespace com::sun::star::sdbc; 62 63 //------------------------------------------------------------------------------ 64 // IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.AResultSet","com.sun.star.sdbc.ResultSet"); 65 ::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ 66 { 67 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ado.ResultSet"); 68 } 69 // ------------------------------------------------------------------------- 70 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) 71 { 72 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); 73 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); 74 aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); 75 return aSupported; 76 } 77 // ------------------------------------------------------------------------- 78 sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) 79 { 80 Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); 81 const ::rtl::OUString* pSupported = aSupported.getConstArray(); 82 const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); 83 for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) 84 ; 85 86 return pSupported != pEnd; 87 } 88 // ------------------------------------------------------------------------- 89 OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) 90 ,OPropertySetHelper(OResultSet_BASE::rBHelper) 91 ,m_xStatement(*pStmt) 92 ,m_pStmt(pStmt) 93 ,m_nRowPos(0) 94 ,m_xMetaData(NULL) 95 ,m_pRecordSet(_pRecordSet) 96 ,m_bEOF(sal_False) 97 { 98 } 99 // ------------------------------------------------------------------------- 100 OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex) 101 ,OPropertySetHelper(OResultSet_BASE::rBHelper) 102 ,m_xStatement(NULL) 103 ,m_xMetaData(NULL) 104 ,m_pRecordSet(_pRecordSet) 105 ,m_bEOF(sal_False) 106 { 107 } 108 // ----------------------------------------------------------------------------- 109 void OResultSet::construct() 110 { 111 osl_incrementInterlockedCount( &m_refCount ); 112 if (!m_pRecordSet) 113 { 114 OSL_ENSURE( sal_False, "OResultSet::construct: no RecordSet!" ); 115 Reference< XInterface > xInt( *this ); 116 osl_decrementInterlockedCount( &m_refCount ); 117 ::dbtools::throwFunctionSequenceException( xInt ); 118 } 119 m_pRecordSet->AddRef(); 120 VARIANT_BOOL bIsAtBOF; 121 CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) 122 m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE; 123 osl_decrementInterlockedCount( &m_refCount ); 124 } 125 // ------------------------------------------------------------------------- 126 OResultSet::~OResultSet() 127 { 128 if(m_pRecordSet) 129 m_pRecordSet->Release(); 130 } 131 // ------------------------------------------------------------------------- 132 void OResultSet::disposing(void) 133 { 134 OPropertySetHelper::disposing(); 135 136 ::osl::MutexGuard aGuard(m_aMutex); 137 if(m_pRecordSet) 138 m_pRecordSet->Close(); 139 m_xStatement.clear(); 140 m_xMetaData.clear(); 141 } 142 // ------------------------------------------------------------------------- 143 Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) 144 { 145 Any aRet = OPropertySetHelper::queryInterface(rType); 146 return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType); 147 } 148 // ------------------------------------------------------------------------- 149 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) 150 { 151 ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), 152 ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), 153 ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); 154 155 return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); 156 } 157 158 // ------------------------------------------------------------------------- 159 160 sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) 161 { 162 ::osl::MutexGuard aGuard( m_aMutex ); 163 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 164 165 166 Reference< XResultSetMetaData > xMeta = getMetaData(); 167 sal_Int32 nLen = xMeta->getColumnCount(); 168 sal_Int32 i = 1; 169 for(;i<=nLen;++i) 170 if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : 171 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) 172 break; 173 return i; 174 } 175 #define BLOCK_SIZE 256 176 // ------------------------------------------------------------------------- 177 Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 178 { 179 ::osl::MutexGuard aGuard( m_aMutex ); 180 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 181 182 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); 183 184 if((aField.GetAttributes() & adFldLong) == adFldLong) 185 { 186 //Copy the data only upto the Actual Size of Field. 187 sal_Int32 nSize = aField.GetActualSize(); 188 Sequence<sal_Int8> aData(nSize); 189 long index = 0; 190 while(index < nSize) 191 { 192 m_aValue = aField.GetChunk(BLOCK_SIZE); 193 if(m_aValue.isNull()) 194 break; 195 UCHAR chData; 196 for(long index2 = 0;index2 < BLOCK_SIZE;++index2) 197 { 198 HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData); 199 if(SUCCEEDED(hr)) 200 { 201 //Take BYTE by BYTE and advance Memory Location 202 aData.getArray()[index++] = chData; 203 } 204 else 205 break; 206 } 207 } 208 209 return new ::comphelper::SequenceInputStream(aData); 210 } 211 // else we ask for a bytesequence 212 aField.get_Value(m_aValue); 213 214 return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue); 215 } 216 // ------------------------------------------------------------------------- 217 Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 218 { 219 ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this ); 220 return NULL; 221 } 222 // ----------------------------------------------------------------------------- 223 OLEVariant OResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 224 { 225 ::osl::MutexGuard aGuard( m_aMutex ); 226 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 227 228 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); 229 aField.get_Value(m_aValue); 230 return m_aValue; 231 } 232 // ------------------------------------------------------------------------- 233 sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 234 { 235 return getValue(columnIndex); 236 } 237 // ------------------------------------------------------------------------- 238 239 sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 240 { 241 return getValue(columnIndex); 242 } 243 // ------------------------------------------------------------------------- 244 245 Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 246 { 247 return getValue(columnIndex); 248 } 249 // ------------------------------------------------------------------------- 250 251 ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 252 { 253 return getValue(columnIndex); 254 } 255 // ------------------------------------------------------------------------- 256 257 double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 258 { 259 return getValue(columnIndex); 260 } 261 // ------------------------------------------------------------------------- 262 263 float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 264 { 265 return getValue(columnIndex); 266 } 267 // ------------------------------------------------------------------------- 268 269 sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 270 { 271 return getValue(columnIndex); 272 } 273 // ------------------------------------------------------------------------- 274 275 sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) 276 { 277 ::osl::MutexGuard aGuard( m_aMutex ); 278 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 279 280 281 PositionEnum aPos; 282 m_pRecordSet->get_AbsolutePosition(&aPos); 283 return (aPos > 0) ? aPos : m_nRowPos; 284 // return the rowcount from driver if the driver doesn't support this return our count 285 } 286 // ------------------------------------------------------------------------- 287 288 sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 289 { 290 ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this ); 291 return sal_Int64(0); 292 } 293 // ------------------------------------------------------------------------- 294 295 Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) 296 { 297 ::osl::MutexGuard aGuard( m_aMutex ); 298 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 299 300 301 if(!m_xMetaData.is()) 302 m_xMetaData = new OResultSetMetaData(m_pRecordSet); 303 return m_xMetaData; 304 } 305 // ------------------------------------------------------------------------- 306 Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 307 { 308 ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this ); 309 return NULL; 310 } 311 312 // ------------------------------------------------------------------------- 313 314 Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 315 { 316 ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this ); 317 return NULL; 318 } 319 // ------------------------------------------------------------------------- 320 Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 321 { 322 ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this ); 323 return NULL; 324 } 325 // ------------------------------------------------------------------------- 326 327 Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 328 { 329 ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this ); 330 return NULL; 331 } 332 // ------------------------------------------------------------------------- 333 334 Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) 335 { 336 return getValue(columnIndex).makeAny(); 337 } 338 // ------------------------------------------------------------------------- 339 340 sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 341 { 342 return getValue(columnIndex); 343 } 344 // ------------------------------------------------------------------------- 345 346 ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 347 { 348 return getValue(columnIndex); 349 } 350 351 // ------------------------------------------------------------------------- 352 353 354 ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 355 { 356 return getValue(columnIndex); 357 } 358 // ------------------------------------------------------------------------- 359 360 361 ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 362 { 363 return getValue(columnIndex); 364 } 365 // ------------------------------------------------------------------------- 366 367 sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) 368 { 369 ::osl::MutexGuard aGuard( m_aMutex ); 370 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 371 372 373 VARIANT_BOOL bIsAtEOF; 374 CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF)) 375 return bIsAtEOF == VARIANT_TRUE; 376 } 377 // ------------------------------------------------------------------------- 378 sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) 379 { 380 ::osl::MutexGuard aGuard( m_aMutex ); 381 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 382 383 384 return m_nRowPos == 1; 385 } 386 // ------------------------------------------------------------------------- 387 sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) 388 { 389 ::osl::MutexGuard aGuard( m_aMutex ); 390 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 391 392 393 return sal_True; 394 } 395 // ------------------------------------------------------------------------- 396 void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) 397 { 398 ::osl::MutexGuard aGuard( m_aMutex ); 399 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 400 401 402 if(first()) 403 m_bOnFirstAfterOpen = !previous(); 404 } 405 // ------------------------------------------------------------------------- 406 void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) 407 { 408 ::osl::MutexGuard aGuard( m_aMutex ); 409 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 410 411 412 if(last()) 413 next(); 414 m_bEOF = sal_True; 415 } 416 // ------------------------------------------------------------------------- 417 418 void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) 419 { 420 { 421 ::osl::MutexGuard aGuard( m_aMutex ); 422 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 423 424 } 425 dispose(); 426 } 427 // ------------------------------------------------------------------------- 428 429 sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) 430 { 431 ::osl::MutexGuard aGuard( m_aMutex ); 432 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 433 434 435 if(SUCCEEDED(m_pRecordSet->MoveFirst())) 436 { 437 m_nRowPos = 1; 438 m_bOnFirstAfterOpen = sal_False; 439 return sal_True; 440 } 441 return sal_False; 442 } 443 // ------------------------------------------------------------------------- 444 445 sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) 446 { 447 ::osl::MutexGuard aGuard( m_aMutex ); 448 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 449 450 451 sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveLast()); 452 if(bRet) 453 { 454 m_pRecordSet->get_RecordCount(&m_nRowPos); 455 m_bOnFirstAfterOpen = sal_False; 456 } 457 return bRet; 458 } 459 // ------------------------------------------------------------------------- 460 sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) 461 { 462 ::osl::MutexGuard aGuard( m_aMutex ); 463 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 464 465 466 if(!row) // absolute with zero not allowed 467 ::dbtools::throwFunctionSequenceException(*this); 468 469 sal_Bool bCheck = sal_True; 470 if(row < 0) 471 { 472 bCheck = SUCCEEDED(m_pRecordSet->MoveLast()); 473 if ( bCheck ) 474 { 475 while(++row < 0 && bCheck) 476 bCheck = SUCCEEDED(m_pRecordSet->MovePrevious()); 477 } 478 } 479 else 480 { 481 first(); 482 OLEVariant aEmpty; 483 aEmpty.setNoArg(); 484 bCheck = SUCCEEDED(m_pRecordSet->Move(row-1,aEmpty)); // move to row -1 because we stand already on the first 485 if(bCheck) 486 m_nRowPos = row; 487 } 488 if(bCheck) 489 m_bOnFirstAfterOpen = sal_False; 490 return bCheck; 491 } 492 // ------------------------------------------------------------------------- 493 sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) 494 { 495 ::osl::MutexGuard aGuard( m_aMutex ); 496 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 497 498 499 OLEVariant aEmpty; 500 aEmpty.setNoArg(); 501 sal_Int32 nNewPos = row; 502 if ( m_bOnFirstAfterOpen && nNewPos > 0 ) 503 --nNewPos; 504 sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); 505 if(bRet) 506 { 507 m_nRowPos += row; 508 m_bOnFirstAfterOpen = sal_False; 509 } 510 return bRet; 511 } 512 // ------------------------------------------------------------------------- 513 sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) 514 { 515 ::osl::MutexGuard aGuard( m_aMutex ); 516 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 517 518 sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious()); 519 if(bRet) 520 { 521 --m_nRowPos; 522 m_bOnFirstAfterOpen = sal_False; 523 } 524 return bRet; 525 } 526 // ------------------------------------------------------------------------- 527 Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) 528 { 529 ::osl::MutexGuard aGuard( m_aMutex ); 530 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 531 return m_xStatement; 532 } 533 // ------------------------------------------------------------------------- 534 535 sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) 536 { 537 ::osl::MutexGuard aGuard( m_aMutex ); 538 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 539 540 541 RecordStatusEnum eRec; 542 m_pRecordSet->get_Status((sal_Int32*)&eRec); 543 sal_Bool bRet = (eRec & adRecDeleted) == adRecDeleted; 544 if(bRet) 545 --m_nRowPos; 546 return bRet; 547 } 548 // ------------------------------------------------------------------------- 549 sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) 550 { ::osl::MutexGuard aGuard( m_aMutex ); 551 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 552 553 554 RecordStatusEnum eRec; 555 m_pRecordSet->get_Status((sal_Int32*)&eRec); 556 sal_Bool bRet = (eRec & adRecNew) == adRecNew; 557 if(bRet) 558 ++m_nRowPos; 559 return bRet; 560 } 561 // ------------------------------------------------------------------------- 562 sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) 563 { 564 ::osl::MutexGuard aGuard( m_aMutex ); 565 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 566 567 568 RecordStatusEnum eRec; 569 m_pRecordSet->get_Status((sal_Int32*)&eRec); 570 return (eRec & adRecModified) == adRecModified; 571 } 572 // ------------------------------------------------------------------------- 573 574 sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) 575 { 576 ::osl::MutexGuard aGuard( m_aMutex ); 577 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 578 579 580 OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!"); 581 VARIANT_BOOL bIsAtBOF = VARIANT_TRUE; 582 if(!m_bOnFirstAfterOpen) 583 { 584 OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!"); 585 m_pRecordSet->get_BOF(&bIsAtBOF); 586 } 587 return bIsAtBOF == VARIANT_TRUE; 588 } 589 // ------------------------------------------------------------------------- 590 591 sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) 592 { 593 ::osl::MutexGuard aGuard( m_aMutex ); 594 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 595 596 597 sal_Bool bRet = sal_True; 598 if(m_bOnFirstAfterOpen) 599 { 600 m_bOnFirstAfterOpen = sal_False; 601 ++m_nRowPos; 602 } 603 else 604 { 605 bRet = SUCCEEDED(m_pRecordSet->MoveNext()); 606 607 if(bRet) 608 { 609 VARIANT_BOOL bIsAtEOF; 610 CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF)) 611 bRet = bIsAtEOF != VARIANT_TRUE; 612 ++m_nRowPos; 613 } 614 else 615 ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this); 616 } 617 618 return bRet; 619 } 620 // ------------------------------------------------------------------------- 621 622 sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) 623 { 624 ::osl::MutexGuard aGuard( m_aMutex ); 625 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 626 627 628 return m_aValue.isNull(); 629 } 630 // ------------------------------------------------------------------------- 631 632 void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) 633 { 634 ::osl::MutexGuard aGuard( m_aMutex ); 635 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 636 637 638 m_pRecordSet->Cancel(); 639 } 640 // ------------------------------------------------------------------------- 641 void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) 642 { 643 } 644 // ------------------------------------------------------------------------- 645 Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) 646 { 647 return Any(); 648 } 649 // ------------------------------------------------------------------------- 650 void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) 651 { 652 ::osl::MutexGuard aGuard( m_aMutex ); 653 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 654 655 656 OLEVariant aEmpty; 657 aEmpty.setNoArg(); 658 m_pRecordSet->AddNew(aEmpty,aEmpty); 659 } 660 // ------------------------------------------------------------------------- 661 void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) 662 { 663 ::osl::MutexGuard aGuard( m_aMutex ); 664 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 665 666 667 OLEVariant aEmpty; 668 aEmpty.setNoArg(); 669 m_pRecordSet->Update(aEmpty,aEmpty); 670 } 671 // ------------------------------------------------------------------------- 672 void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) 673 { 674 ::osl::MutexGuard aGuard( m_aMutex ); 675 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 676 677 678 m_pRecordSet->Delete(adAffectCurrent); 679 m_pRecordSet->UpdateBatch(adAffectCurrent); 680 } 681 // ------------------------------------------------------------------------- 682 683 void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) 684 { 685 ::osl::MutexGuard aGuard( m_aMutex ); 686 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 687 688 689 m_pRecordSet->CancelUpdate(); 690 } 691 // ------------------------------------------------------------------------- 692 693 void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) 694 { 695 // ::osl::MutexGuard aGuard( m_aMutex ); 696 //checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 697 // if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY ) 698 // throw SQLException(); 699 } 700 // ------------------------------------------------------------------------- 701 702 void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) 703 { 704 } 705 // ----------------------------------------------------------------------------- 706 void OResultSet::updateValue(sal_Int32 columnIndex,const OLEVariant& x) 707 { 708 ::osl::MutexGuard aGuard( m_aMutex ); 709 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 710 711 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); 712 aField.PutValue(x); 713 } 714 // ------------------------------------------------------------------------- 715 void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 716 { 717 OLEVariant x; 718 x.setNull(); 719 updateValue(columnIndex,x); 720 } 721 // ------------------------------------------------------------------------- 722 723 void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) 724 { 725 updateValue(columnIndex,x); 726 } 727 // ------------------------------------------------------------------------- 728 void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) 729 { 730 updateValue(columnIndex,x); 731 } 732 // ------------------------------------------------------------------------- 733 734 void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) 735 { 736 updateValue(columnIndex,x); 737 } 738 // ------------------------------------------------------------------------- 739 void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) 740 { 741 updateValue(columnIndex,x); 742 } 743 // ------------------------------------------------------------------------- 744 void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) 745 { 746 updateValue(columnIndex,x); 747 } 748 // ----------------------------------------------------------------------- 749 void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) 750 { 751 updateValue(columnIndex,x); 752 } 753 // ------------------------------------------------------------------------- 754 755 void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) 756 { 757 updateValue(columnIndex,x); 758 } 759 // ------------------------------------------------------------------------- 760 void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) 761 { 762 updateValue(columnIndex,x); 763 } 764 // ------------------------------------------------------------------------- 765 void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) 766 { 767 updateValue(columnIndex,x); 768 } 769 // ------------------------------------------------------------------------- 770 void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) 771 { 772 updateValue(columnIndex,x); 773 } 774 // ------------------------------------------------------------------------- 775 776 void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) 777 { 778 updateValue(columnIndex,x); 779 } 780 // ------------------------------------------------------------------------- 781 782 void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) 783 { 784 updateValue(columnIndex,x); 785 } 786 // ------------------------------------------------------------------------- 787 788 void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) 789 { 790 if(!x.is()) 791 ::dbtools::throwFunctionSequenceException(*this); 792 793 Sequence<sal_Int8> aSeq; 794 x->readBytes(aSeq,length); 795 updateBytes(columnIndex,aSeq); 796 } 797 // ------------------------------------------------------------------------- 798 void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) 799 { 800 if(!x.is()) 801 ::dbtools::throwFunctionSequenceException(*this); 802 803 Sequence<sal_Int8> aSeq; 804 x->readBytes(aSeq,length); 805 updateBytes(columnIndex,aSeq); 806 } 807 // ------------------------------------------------------------------------- 808 void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) 809 { 810 ::osl::MutexGuard aGuard( m_aMutex ); 811 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 812 813 814 m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues); 815 } 816 // ------------------------------------------------------------------------- 817 void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) 818 { 819 if (!::dbtools::implUpdateObject(this, columnIndex, x)) 820 throw SQLException(); 821 } 822 // ------------------------------------------------------------------------- 823 824 void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) 825 { 826 if (!::dbtools::implUpdateObject(this, columnIndex, x)) 827 throw SQLException(); 828 } 829 //------------------------------------------------------------------------------ 830 // XRowLocate 831 Any SAL_CALL OResultSet::getBookmark( ) throw(SQLException, RuntimeException) 832 { 833 ::osl::MutexGuard aGuard( m_aMutex ); 834 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 835 836 if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched 837 return makeAny(sal_Int32(m_nRowPos-1)); 838 839 OLEVariant aVar; 840 m_pRecordSet->get_Bookmark(&aVar); 841 m_aBookmarks.push_back(aVar); 842 return makeAny((sal_Int32)(m_aBookmarks.size()-1)); 843 844 } 845 //------------------------------------------------------------------------------ 846 sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) 847 { 848 ::osl::MutexGuard aGuard( m_aMutex ); 849 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 850 851 852 sal_Int32 nPos; 853 bookmark >>= nPos; 854 OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector"); 855 if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size()) 856 ::dbtools::throwFunctionSequenceException(*this); 857 858 return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos])); 859 } 860 //------------------------------------------------------------------------------ 861 sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) 862 { 863 ::osl::MutexGuard aGuard( m_aMutex ); 864 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 865 866 867 sal_Int32 nPos; 868 bookmark >>= nPos; 869 nPos += rows; 870 OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector"); 871 if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size()) 872 ::dbtools::throwFunctionSequenceException(*this); 873 return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos])); 874 } 875 //------------------------------------------------------------------------------ 876 sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException) 877 { 878 ::osl::MutexGuard aGuard( m_aMutex ); 879 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 880 881 sal_Int32 nPos1; 882 first >>= nPos1; 883 sal_Int32 nPos2; 884 second >>= nPos2; 885 if(nPos1 == nPos2) // they should be equal 886 return sal_True; 887 888 OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector"); 889 890 CompareEnum eNum; 891 m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum); 892 return ((sal_Int32)eNum) +1; 893 } 894 //------------------------------------------------------------------------------ 895 sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) 896 { 897 ::osl::MutexGuard aGuard( m_aMutex ); 898 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 899 900 901 ADOProperties* pProps = NULL; 902 m_pRecordSet->get_Properties(&pProps); 903 WpADOProperties aProps; 904 aProps.setWithOutAddRef(pProps); 905 ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this); 906 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection"); 907 908 WpADOProperty aProp(aProps.GetItem(::rtl::OUString::createFromAscii("Bookmarks Ordered"))); 909 OLEVariant aVar; 910 if(aProp.IsValid()) 911 aVar = aProp.GetValue(); 912 else 913 ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this); 914 915 sal_Bool bValue(sal_False); 916 if(!aVar.isNull() && !aVar.isEmpty()) 917 bValue = aVar; 918 return bValue; 919 } 920 //------------------------------------------------------------------------------ 921 sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) 922 { 923 ::osl::MutexGuard aGuard( m_aMutex ); 924 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 925 926 927 sal_Int32 nPos; 928 bookmark >>= nPos; 929 return nPos; 930 } 931 //------------------------------------------------------------------------------ 932 // XDeleteRows 933 Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException) 934 { 935 ::osl::MutexGuard aGuard( m_aMutex ); 936 checkDisposed(OResultSet_BASE::rBHelper.bDisposed); 937 938 939 OLEVariant aVar; 940 sal_Int32 nPos; 941 942 // Create SafeArray Bounds and initialize the array 943 SAFEARRAYBOUND rgsabound[1]; 944 rgsabound[0].lLbound = 0; 945 rgsabound[0].cElements = rows.getLength(); 946 SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); 947 948 const Any* pBegin = rows.getConstArray(); 949 const Any* pEnd = pBegin + rows.getLength(); 950 for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i) 951 { 952 *pBegin >>= nPos; 953 SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]); 954 } 955 956 // Initialize and fill the SafeArray 957 OLEVariant vsa; 958 vsa.setArray(psa,VT_VARIANT); 959 960 m_pRecordSet->put_Filter(vsa); 961 m_pRecordSet->Delete(adAffectGroup); 962 m_pRecordSet->UpdateBatch(adAffectGroup); 963 964 Sequence< sal_Int32 > aSeq(rows.getLength()); 965 if(first()) 966 { 967 sal_Int32* pSeq = aSeq.getArray(); 968 sal_Int32 i=0; 969 do 970 { 971 OSL_ENSURE(i<aSeq.getLength(),"Index greater than length of sequence"); 972 m_pRecordSet->get_Status(&pSeq[i]); 973 if(pSeq[i++] == adRecDeleted) 974 --m_nRowPos; 975 } 976 while(next()); 977 } 978 return aSeq; 979 } 980 //------------------------------------------------------------------------------ 981 sal_Int32 OResultSet::getResultSetConcurrency() const 982 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 983 { 984 sal_Int32 nValue=ResultSetConcurrency::READ_ONLY; 985 LockTypeEnum eRet; 986 if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet))) 987 { 988 switch(eRet) 989 { 990 case adLockReadOnly: 991 nValue = ResultSetConcurrency::READ_ONLY; 992 break; 993 default: 994 nValue = ResultSetConcurrency::UPDATABLE; 995 break; 996 } 997 } 998 return nValue; 999 } 1000 //------------------------------------------------------------------------------ 1001 sal_Int32 OResultSet::getResultSetType() const 1002 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1003 { 1004 sal_Int32 nValue=0; 1005 CursorTypeEnum eRet; 1006 if(!SUCCEEDED(m_pRecordSet->get_CursorType(&eRet))) 1007 { 1008 switch(eRet) 1009 { 1010 case adOpenUnspecified: 1011 case adOpenForwardOnly: 1012 nValue = ResultSetType::FORWARD_ONLY; 1013 break; 1014 case adOpenStatic: 1015 case adOpenKeyset: 1016 nValue = ResultSetType::SCROLL_INSENSITIVE; 1017 break; 1018 case adOpenDynamic: 1019 nValue = ResultSetType::SCROLL_SENSITIVE; 1020 break; 1021 } 1022 } 1023 return nValue; 1024 } 1025 //------------------------------------------------------------------------------ 1026 sal_Int32 OResultSet::getFetchDirection() const 1027 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1028 { 1029 return FetchDirection::FORWARD; 1030 } 1031 //------------------------------------------------------------------------------ 1032 sal_Int32 OResultSet::getFetchSize() const 1033 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1034 { 1035 sal_Int32 nValue=-1; 1036 m_pRecordSet->get_CacheSize(&nValue); 1037 return nValue; 1038 } 1039 //------------------------------------------------------------------------------ 1040 ::rtl::OUString OResultSet::getCursorName() const 1041 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1042 { 1043 return ::rtl::OUString(); 1044 } 1045 1046 //------------------------------------------------------------------------------ 1047 void OResultSet::setFetchDirection(sal_Int32 /*_par0*/) 1048 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1049 { 1050 ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this ); 1051 } 1052 //------------------------------------------------------------------------------ 1053 void OResultSet::setFetchSize(sal_Int32 _par0) 1054 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 1055 { 1056 m_pRecordSet->put_CacheSize(_par0); 1057 } 1058 // ------------------------------------------------------------------------- 1059 ::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const 1060 { 1061 Sequence< com::sun::star::beans::Property > aProps(5); 1062 com::sun::star::beans::Property* pProperties = aProps.getArray(); 1063 sal_Int32 nPos = 0; 1064 1065 // DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); 1066 DECL_PROP0(FETCHDIRECTION, sal_Int32); 1067 DECL_PROP0(FETCHSIZE, sal_Int32); 1068 DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); 1069 DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); 1070 DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); 1071 1072 return new ::cppu::OPropertyArrayHelper(aProps); 1073 } 1074 // ------------------------------------------------------------------------- 1075 ::cppu::IPropertyArrayHelper & OResultSet::getInfoHelper() 1076 { 1077 return *const_cast<OResultSet*>(this)->getArrayHelper(); 1078 } 1079 // ------------------------------------------------------------------------- 1080 sal_Bool OResultSet::convertFastPropertyValue( 1081 Any & rConvertedValue, 1082 Any & rOldValue, 1083 sal_Int32 nHandle, 1084 const Any& rValue ) 1085 throw (::com::sun::star::lang::IllegalArgumentException) 1086 { 1087 switch(nHandle) 1088 { 1089 case PROPERTY_ID_ISBOOKMARKABLE: 1090 case PROPERTY_ID_CURSORNAME: 1091 case PROPERTY_ID_RESULTSETCONCURRENCY: 1092 case PROPERTY_ID_RESULTSETTYPE: 1093 throw ::com::sun::star::lang::IllegalArgumentException(); 1094 break; 1095 case PROPERTY_ID_FETCHDIRECTION: 1096 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); 1097 case PROPERTY_ID_FETCHSIZE: 1098 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); 1099 default: 1100 ; 1101 } 1102 return sal_False; 1103 } 1104 // ------------------------------------------------------------------------- 1105 void OResultSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) 1106 { 1107 switch(nHandle) 1108 { 1109 case PROPERTY_ID_ISBOOKMARKABLE: 1110 case PROPERTY_ID_CURSORNAME: 1111 case PROPERTY_ID_RESULTSETCONCURRENCY: 1112 case PROPERTY_ID_RESULTSETTYPE: 1113 throw Exception(); 1114 break; 1115 case PROPERTY_ID_FETCHDIRECTION: 1116 setFetchDirection(getINT32(rValue)); 1117 break; 1118 case PROPERTY_ID_FETCHSIZE: 1119 setFetchSize(getINT32(rValue)); 1120 break; 1121 default: 1122 ; 1123 } 1124 } 1125 // ------------------------------------------------------------------------- 1126 void OResultSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const 1127 { 1128 switch(nHandle) 1129 { 1130 case PROPERTY_ID_ISBOOKMARKABLE: 1131 { 1132 VARIANT_BOOL bBool; 1133 m_pRecordSet->Supports(adBookmark,&bBool); 1134 sal_Bool bRet = bBool == VARIANT_TRUE; 1135 rValue.setValue(&bRet, ::getCppuBooleanType() ); 1136 } 1137 break; 1138 case PROPERTY_ID_CURSORNAME: 1139 rValue <<= getCursorName(); 1140 break; 1141 case PROPERTY_ID_RESULTSETCONCURRENCY: 1142 rValue <<= getResultSetConcurrency(); 1143 break; 1144 case PROPERTY_ID_RESULTSETTYPE: 1145 rValue <<= getResultSetType(); 1146 break; 1147 case PROPERTY_ID_FETCHDIRECTION: 1148 rValue <<= getFetchDirection(); 1149 break; 1150 case PROPERTY_ID_FETCHSIZE: 1151 rValue <<= getFetchSize(); 1152 break; 1153 } 1154 } 1155 // ----------------------------------------------------------------------------- 1156 void SAL_CALL OResultSet::acquire() throw() 1157 { 1158 OResultSet_BASE::acquire(); 1159 } 1160 // ----------------------------------------------------------------------------- 1161 void SAL_CALL OResultSet::release() throw() 1162 { 1163 OResultSet_BASE::release(); 1164 } 1165 // ----------------------------------------------------------------------------- 1166 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 1167 { 1168 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); 1169 } 1170 // ----------------------------------------------------------------------------- 1171 1172 1173 1174