Tag: cws_src680_dba23b User: fs Date: 2007-07-02 20:07:15+0000 Modified: dba/dbaccess/source/core/api/RowSetBase.cxx
Log: #i78410# fix getBinaryStream so there's no recursion File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: RowSetBase.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetBase.cxx?r1=1.92&r2=1.92.14.1 Delta lines: +26 -22 --------------------- --- RowSetBase.cxx 2007-05-10 10:11:05+0000 1.92 +++ RowSetBase.cxx 2007-07-02 20:07:12+0000 1.92.14.1 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetBase.cxx,v $ * - * $Revision: 1.92 $ + * $Revision: 1.92.14.1 $ * - * last change: $Author: kz $ $Date: 2007/05/10 10:11:05 $ + * last change: $Author: fs $ $Date: 2007/07/02 20:07:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -255,19 +255,17 @@ // ----------------------------------------------------------------------------- const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) { - DBG_TRACE2("DBACCESS ORowSetBase::getValue() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); - checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + // TODO: resource } if ( rowDeleted() ) { - DBG_TRACE2("DBACCESS ORowSetBase::getValue() Clone = %i rowDeleted() ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); return m_aEmptyValue; } @@ -308,7 +306,6 @@ return (*(*m_aCurrentRow))[m_nLastColumnIndex = columnIndex]; } - DBG_TRACE2("DBACCESS ORowSetBase::getValue() Clone = %i EmptyValue ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); // we should normally never reach this return m_aEmptyValue; } @@ -390,27 +387,32 @@ ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - - if( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd()) - return new ::comphelper::SequenceInputStream((*(*m_aCurrentRow))[m_nLastColumnIndex = columnIndex].getSequence()); - else - { - if(!m_aCurrentRow.isNull()) - OSL_ENSURE((m_bBeforeFirst || m_bAfterLast),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is equal to end of matrix"); - else + if ( m_bBeforeFirst || m_bAfterLast ) { + OSL_ENSURE(0,"ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); + throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + // TODO: resource + } + if ( rowDeleted() ) + { return NULL; + } + bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); + if ( !bValidCurrentRow ) + { positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; - OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null."); - return getBinaryStream(columnIndex); - } + + bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); } + if ( bValidCurrentRow ) + return new ::comphelper::SequenceInputStream((*(*m_aCurrentRow))[m_nLastColumnIndex = columnIndex].getSequence()); + // we should normally never reach this return Reference< ::com::sun::star::io::XInputStream >(); } // ------------------------------------------------------------------------- @@ -461,9 +463,11 @@ if ( m_bBeforeFirst || m_bAfterLast ) throwSQLException( "The rows before the first and after the last row don't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + // TODO: resource if ( rowDeleted() ) - throwSQLException( "The current row is deleted, and this doesn't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + throwSQLException( "The current row is deleted, and thus doesn't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + // TODO: resource OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" ); return m_aBookmark; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
