diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-06-26 09:30:55 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-06-26 09:30:55 +0000 |
commit | 8dda8161ca466632653aa5eb3e63f5ef6bb5696c (patch) | |
tree | 2779cb9ed646f1b1f3c99cc57ff3bb94a8b12638 | |
parent | e876abd02a5b5f6515d22aa952de38453e36a6f5 (diff) |
#87808# setObject corrected and some more
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 598 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.hxx | 36 | ||||
-rw-r--r-- | dbaccess/source/core/api/resultset.cxx | 324 | ||||
-rw-r--r-- | dbaccess/source/core/api/resultset.hxx | 6 |
4 files changed, 305 insertions, 659 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 9cbab8cf5588..762fc3656bc1 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSetCache.cxx,v $ * - * $Revision: 1.37 $ + * $Revision: 1.38 $ * - * last change: $Author: fs $ $Date: 2001-06-26 09:32:05 $ + * last change: $Author: oj $ $Date: 2001-06-26 10:30:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -434,8 +434,8 @@ sal_Bool SAL_CALL ORowSetCache::wasNull( ) throw(SQLException, RuntimeException return (*(*m_aMatrixIter))[m_nLastColumnIndex].isNull(); } -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL ORowSetCache::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +ORowSetValue ORowSetCache::getValue(sal_Int32 columnIndex) { if(m_bAfterLast) throwFunctionSequenceException(m_xSet.get()); @@ -443,129 +443,67 @@ sal_Bool SAL_CALL ORowSetCache::wasNull( ) throw(SQLException, RuntimeException OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); m_nLastColumnIndex = columnIndex; - ::rtl::OUString aRet; return (*(*m_aMatrixIter))[m_nLastColumnIndex]; } // ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ORowSetCache::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + return getValue(columnIndex); +} +// ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSetCache::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSetCache::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetCache::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSetCache::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSetCache::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSetCache::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSetCache::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSetCache::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSetCache::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSetCache::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast) - throwFunctionSequenceException(m_xSet.get()); - - OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"Iterator is equal end()"); - - m_nLastColumnIndex = columnIndex; - return (*(*m_aMatrixIter))[m_nLastColumnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetCache::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) @@ -665,23 +603,13 @@ sal_Bool SAL_CALL ORowSetCache::moveToBookmark( const Any& bookmark ) throw(SQLE { m_bDeleted = m_bBeforeFirst = sal_False; m_nPosition = m_pCacheSet->getRow(); - if(m_bRowCountFinal) - { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; - } + + checkPositionFlags(); + if(!m_bAfterLast) { moveWindow(); - if(m_bRowCountFinal) // check again - { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; - } + checkPositionFlags(); if(!m_bAfterLast) m_aMatrixIter = m_pMatrix->begin() + (m_nPosition - m_nStartPos) - 1; // must be -1 else @@ -713,10 +641,7 @@ sal_Bool SAL_CALL ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetCache::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException) { - if(!first.hasValue() || !second.hasValue()) - return CompareBookmark::NOT_COMPARABLE; - - return m_pCacheSet->compareBookmarks(first,second); + return (!first.hasValue() || !second.hasValue()) ? CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(first,second); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) @@ -729,250 +654,60 @@ sal_Int32 SAL_CALL ORowSetCache::hashBookmark( const Any& bookmark ) throw(SQLEx return m_pCacheSet->hashBookmark(bookmark); } // ------------------------------------------------------------------------- -#ifdef DBG_UTIL -void ORowSetCache::columnModified(sal_Int32 columnIndex) -{ -} -#endif - // XRowUpdate void SAL_CALL ORowSetCache::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex].setNull(); - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = (sal_Int32)x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = (sal_Int32)x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); + updateValue(columnIndex,ORowSetValue()); } -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex].setFromDouble(x,m_xMetaData->getColumnType(columnIndex)); - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) -{ - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); - - ::osl::MutexGuard aGuard( m_aColumnsMutex ); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = x; - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); -} -// ------------------------------------------------------------------------- -void SAL_CALL ORowSetCache::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) { - if(m_bAfterLast || columnIndex < 1 || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); + checkUpdateConditions(columnIndex); ::osl::MutexGuard aGuard( m_aColumnsMutex ); (*(*m_aInsertRow))[columnIndex].setBound(sal_True); (*(*m_aInsertRow))[columnIndex] = x; (*(*m_aInsertRow))[columnIndex].setModified(); m_bModified = sal_True; - - columnModified(columnIndex); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - if(m_bAfterLast || columnIndex < 1 || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); + checkUpdateConditions(columnIndex); ::osl::MutexGuard aGuard( m_aColumnsMutex ); Sequence<sal_Int8> aSeq; if(x.is()) x->readSomeBytes(aSeq,length); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = aSeq; - // (*(*m_aInsertRow))[columnIndex].setTypeKind(DataType::BLOB); - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); + updateValue(columnIndex,aSeq); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - if(m_bAfterLast || columnIndex < 1 || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); + checkUpdateConditions(columnIndex); ::osl::MutexGuard aGuard( m_aColumnsMutex ); Sequence<sal_Int8> aSeq; if(x.is()) x->readSomeBytes(aSeq,length); - (*(*m_aInsertRow))[columnIndex].setBound(sal_True); - (*(*m_aInsertRow))[columnIndex] = aSeq; - // (*(*m_aInsertRow))[columnIndex].setTypeKind(DataType::CLOB); - (*(*m_aInsertRow))[columnIndex].setModified(); - m_bModified = sal_True; - - columnModified(columnIndex); + updateValue(columnIndex,aSeq); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { - if(m_bAfterLast || columnIndex < 1 || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); + checkUpdateConditions(columnIndex); ::osl::MutexGuard aGuard( m_aColumnsMutex ); (*(*m_aInsertRow))[columnIndex].setBound(sal_True); (*(*m_aInsertRow))[columnIndex] = x; (*(*m_aInsertRow))[columnIndex].setModified(); m_bModified = sal_True; - - columnModified(columnIndex); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { - if(m_bAfterLast || columnIndex < 1 || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) - throwFunctionSequenceException(m_xSet.get()); + checkUpdateConditions(columnIndex); ::osl::MutexGuard aGuard( m_aColumnsMutex ); (*(*m_aInsertRow))[columnIndex].setBound(sal_True); @@ -980,7 +715,6 @@ void SAL_CALL ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const An (*(*m_aInsertRow))[columnIndex].setModified(); m_bModified = sal_True; - columnModified(columnIndex); } // ------------------------------------------------------------------------- // XResultSet @@ -988,33 +722,19 @@ sal_Bool SAL_CALL ORowSetCache::next( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(isAfterLast()) - return sal_False; - - m_bBeforeFirst = sal_False; - ++m_nPosition; - // after we increment the position we have to check if we are already after the last row - if(m_bRowCountFinal) + if(!isAfterLast()) { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; - } - if(!m_bAfterLast) - { - - moveWindow(); - // readForward(); - - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); - m_aMatrixIter = m_pMatrix->begin() + m_nPosition - m_nStartPos -1; // -1 because rows start at zero - if(m_bRowCountFinal) + m_bBeforeFirst = sal_False; + ++m_nPosition; + // after we increment the position we have to check if we are already after the last row + checkPositionFlags(); + if(!m_bAfterLast) { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; + moveWindow(); + + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + m_aMatrixIter = m_pMatrix->begin() + m_nPosition - m_nStartPos -1; // -1 because rows start at zero + checkPositionFlags(); } } @@ -1024,6 +744,7 @@ sal_Bool SAL_CALL ORowSetCache::next( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL ORowSetCache::isBeforeFirst( ) throw(SQLException, RuntimeException) { // return !m_nPosition; + ::osl::MutexGuard aGuard( m_aRowCountMutex ); return m_bBeforeFirst; } // ------------------------------------------------------------------------- @@ -1031,59 +752,63 @@ sal_Bool SAL_CALL ORowSetCache::isAfterLast( ) throw(SQLException, RuntimeExcep { // return m_pCacheSet->isAfterLast(); // return m_bRowCountFinal ? m_bAfterLast : m_pCacheSet->isAfterLast(); + ::osl::MutexGuard aGuard( m_aRowCountMutex ); return m_bAfterLast; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::isFirst( ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aRowCountMutex ); return m_nPosition == 1; // ask resultset for } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::isLast( ) throw(SQLException, RuntimeException) { // return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast(); - return m_nPosition==m_nRowCount; + ::osl::MutexGuard aGuard( m_aRowCountMutex ); + return m_nPosition == m_nRowCount; } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::beforeFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); -// if(m_bInserted) -// m_bInserted = sal_False; - - m_bAfterLast = m_bLast = sal_False; - m_nPosition = 0; - m_bBeforeFirst = sal_True; - m_pCacheSet->beforeFirst(); - moveWindow(); - m_aMatrixIter = m_pMatrix->end(); + if(!m_bBeforeFirst) + { + m_bAfterLast = m_bLast = sal_False; + m_nPosition = 0; + m_bBeforeFirst = sal_True; + m_pCacheSet->beforeFirst(); + moveWindow(); + m_aMatrixIter = m_pMatrix->end(); + } } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::afterLast( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); -// if(m_bInserted) -// m_bInserted = sal_False; + if(!m_bAfterLast) + { + m_bBeforeFirst = m_bLast = sal_False; + m_bAfterLast = sal_True; - m_bBeforeFirst = m_bLast = sal_False; - m_bAfterLast = sal_True; + if(!m_bRowCountFinal) + { + m_pCacheSet->last(); + m_bRowCountFinal = sal_True; + m_nRowCount = m_pCacheSet->getRow();// + 1 removed + } + m_pCacheSet->afterLast(); - m_pCacheSet->last(); - if(!m_bRowCountFinal) - { - m_bRowCountFinal = sal_True; - m_nRowCount = m_pCacheSet->getRow();// + 1 removed + m_nPosition = 0; + m_aMatrixIter = m_pMatrix->end(); } - m_pCacheSet->afterLast(); - - m_nPosition = 0; - m_aMatrixIter = m_pMatrix->end(); } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos) { + OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!"); // fill the whole window with new data ORowSetMatrix::iterator aIter = m_pMatrix->begin(); sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to @@ -1203,14 +928,12 @@ sal_Bool ORowSetCache::moveWindow() } ::std::rotate(m_pMatrix->begin(),aEnd,m_pMatrix->end()); // now correct the iterator in our iterator vector - // rotateCacheIterator(aEnd-m_pMatrix->begin()); + // rotateCacheIterator(aEnd-m_pMatrix->begin()); //can't be used because they decrement and here we need to increment sal_Int16 _nDist = aEnd-m_pMatrix->begin(); ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) { - if(!aCacheIter->second.aIterator) - continue; - if(aCacheIter->second.aIterator != m_aInsertRow && !m_bInserted && !m_bModified) + if(aCacheIter->second.aIterator && aCacheIter->second.aIterator != m_aInsertRow && !m_bInserted && !m_bModified) { sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); if(nDist > _nDist) @@ -1283,10 +1006,8 @@ sal_Bool ORowSetCache::moveWindow() { if(!m_bRowCountFinal) { - if(m_pCacheSet->previous()) // because we stand after the last row - m_nRowCount = m_pCacheSet->getRow();// + 1 removed - else - m_nRowCount = 0; + // because we stand after the last row + m_nRowCount = m_pCacheSet->previous() ? m_pCacheSet->getRow() : 0;// + 1 removed m_bRowCountFinal = sal_True; } } @@ -1371,7 +1092,7 @@ sal_Bool ORowSetCache::moveWindow() sal_Int32 nNewSt = nNewStartPos; bRet = fillMatrix(nNewSt,nNewEndPos); m_nStartPos = nNewSt - 1; - rotateCacheIterator(m_nFetchSize+1); + rotateCacheIterator(m_nFetchSize+1); // forces that every iterator will be set to null } } @@ -1386,9 +1107,6 @@ sal_Bool SAL_CALL ORowSetCache::first( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); -// if(m_bInserted) -// m_bInserted = sal_False; - // first move to the first row // then check if the cache window is at the begining // when not postionize the window and fill it with data @@ -1402,7 +1120,10 @@ sal_Bool SAL_CALL ORowSetCache::first( ) throw(SQLException, RuntimeException) m_aMatrixIter = m_pMatrix->begin(); } else + { + OSL_ENSURE(m_bBeforeFirst,"ORowSetCache::first return false and BeforeFirst isn't true"); m_aMatrixIter = m_pMatrix->end(); + } return bRet; } // ------------------------------------------------------------------------- @@ -1410,9 +1131,6 @@ sal_Bool SAL_CALL ORowSetCache::last( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); -// if(m_bInserted) -// m_bInserted = sal_False; - sal_Bool bRet = m_pCacheSet->last(); if(bRet) { @@ -1433,7 +1151,10 @@ sal_Bool SAL_CALL ORowSetCache::last( ) throw(SQLException, RuntimeException) m_aMatrixIter = m_pMatrix->begin() + m_nPosition - 1; } else + { + OSL_ENSURE(m_bBeforeFirst,"ORowSetCache::last return false and BeforeFirst isn't true"); m_aMatrixIter = m_pMatrix->end(); + } #ifdef DEBUG if(bRet) { @@ -1446,9 +1167,9 @@ sal_Bool SAL_CALL ORowSetCache::last( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetCache::getRow( ) throw(SQLException, RuntimeException) { - if(isBeforeFirst() || isAfterLast()) - return 0; - return m_nPosition; + ::osl::MutexGuard aGuard( m_aRowCountMutex ); + + return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) @@ -1460,6 +1181,8 @@ sal_Bool SAL_CALL ORowSetCache::absolute( sal_Int32 row ) throw(SQLException, Ru if(row < 0) { + // here we have to scroll from the last row to backward so we have to go to last row and + // and two the previous if(m_bRowCountFinal || last()) { m_nPosition = m_nRowCount + row + 1; // + row because row is negative and +1 because row==-1 means last row @@ -1487,24 +1210,12 @@ sal_Bool SAL_CALL ORowSetCache::absolute( sal_Int32 row ) throw(SQLException, Ru m_nPosition = row; // the position flags m_bBeforeFirst = sal_False; - if(m_bRowCountFinal) - { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; - } + checkPositionFlags(); if(!m_bAfterLast) { moveWindow(); - if(m_bRowCountFinal) // check again - { - m_bAfterLast = m_nPosition > m_nRowCount; - m_bLast = m_nPosition == m_nRowCount; - if(m_bAfterLast) - m_nPosition = 0;//m_nRowCount; - } + checkPositionFlags(); if(!m_bAfterLast) m_aMatrixIter = m_pMatrix->begin() + (m_nPosition - m_nStartPos) - 1; // must be -1 else @@ -1521,51 +1232,53 @@ sal_Bool SAL_CALL ORowSetCache::relative( sal_Int32 rows ) throw(SQLException, R { ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(!rows) - return sal_True; - if(m_bBeforeFirst || (m_bRowCountFinal && m_bAfterLast)) - throw SQLException(); + sal_Bool bErg = sal_True; + if(rows) + { + if(m_bBeforeFirst || (m_bRowCountFinal && m_bAfterLast)) + throw SQLException(); - if(!(m_nPosition + rows)) - return !(m_bBeforeFirst = sal_True); - sal_Bool bErg = absolute(m_nPosition + rows); + if(m_nPosition + rows) + { + bErg = absolute(m_nPosition + rows); - return bErg && !isAfterLast() && !isBeforeFirst(); + bErg = bErg && !isAfterLast() && !isBeforeFirst(); + } + else + bErg = !(m_bBeforeFirst = sal_True); + } + return bErg; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetCache::previous( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(isBeforeFirst()) - return sal_False; - -// if(m_bInserted) -// m_bInserted = sal_False; - - if(m_bAfterLast) - return last(); - - m_bAfterLast = sal_False; - --m_nPosition; - moveWindow(); - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); - m_aMatrixIter = m_pMatrix->begin() + m_nPosition - m_nStartPos -1; // must be -1 - - if(m_bRowCountFinal) + sal_Bool bRet = sal_False; + if(!isBeforeFirst()) { - m_bLast = m_nRowCount == m_nPosition; - m_bAfterLast = m_nPosition > m_nRowCount; - } + if(m_bAfterLast) // we stand after the last row so one before is the last row + bRet = last(); + else + { + m_bAfterLast = sal_False; + --m_nPosition; + moveWindow(); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + m_aMatrixIter = m_pMatrix->begin() + m_nPosition - m_nStartPos -1; // must be -1 - if(!m_nPosition) - { - m_bBeforeFirst = sal_True; - m_aMatrixIter = m_pMatrix->end(); - return sal_False; - } + checkPositionFlags(); - return (*m_aMatrixIter).isValid(); + if(!m_nPosition) + { + m_bBeforeFirst = sal_True; + m_aMatrixIter = m_pMatrix->end(); + } + else + bRet = (*m_aMatrixIter).isValid(); + } + } + return bRet; } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::refreshRow( ) throw(SQLException, RuntimeException) @@ -1635,7 +1348,18 @@ void ORowSetCache::cancelInsert() m_bNew = sal_False; m_bModified = sal_False; m_bInserted = sal_False; - m_aInsertRow = m_aMatrixIter; + + // clear the insertrow references -> implies that the current row of the rowset changes as well + ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); + for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) + { + if(aCacheIter->second.aIterator) + { + ORowSetMatrix::iterator aOldIter = aCacheIter->second.aIterator; + if(aOldIter == m_aInsertRow) + aCacheIter->second.aIterator = NULL; + } + } } // ------------------------------------------------------------------------- void SAL_CALL ORowSetCache::updateRow( ) throw(SQLException, RuntimeException) @@ -1815,21 +1539,22 @@ ORowSetCacheIterator ORowSetCache::createIterator() // ----------------------------------------------------------------------------- void ORowSetCache::rotateCacheIterator(sal_Int16 _nDist) { - // now correct the iterator in our iterator vector - ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); - for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) + if(_nDist) { - if(!aCacheIter->second.aIterator) - continue; - if(aCacheIter->second.aIterator != m_aInsertRow && !m_bInserted && !m_bModified) + // now correct the iterator in our iterator vector + ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); + for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) { - sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); - if(nDist < _nDist) + if(aCacheIter->second.aIterator && aCacheIter->second.aIterator != m_aInsertRow && !m_bInserted && !m_bModified) { - aCacheIter->second.aIterator = NULL; + sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); + if(nDist < _nDist) + { + aCacheIter->second.aIterator = NULL; + } + else + aCacheIter->second.aIterator -= _nDist; } - else - aCacheIter->second.aIterator -= _nDist; } } } @@ -1857,9 +1582,28 @@ void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRo aIter->setModified(sal_False); } // ----------------------------------------------------------------------------- +void ORowSetCache::checkPositionFlags() +{ + if(m_bRowCountFinal) + { + m_bAfterLast = m_nPosition > m_nRowCount; + m_bLast = m_nPosition == m_nRowCount; + if(m_bAfterLast) + m_nPosition = 0;//m_nRowCount; + } +} +// ----------------------------------------------------------------------------- +void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex) +{ + if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->size()) + throwFunctionSequenceException(m_xSet.get()); +} /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.37 2001/06/26 09:32:05 fs + #88392# added columnModified for diagnostics + Revision 1.36 2001/06/22 13:08:06 oj #88012# a new method for repositioning the cache diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 460499d0990c..dc630478babc 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RowSetCache.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2001-06-26 09:32:05 $ + * last change: $Author: oj $ $Date: 2001-06-26 10:30:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -200,8 +200,8 @@ namespace dbaccess sal_Int32 m_nPosition; // 0 means beforefirst sal_Int32 m_nAsyncUpdateRowCount; - sal_Int32 m_nStartPos; // start pos of the window - sal_Int32 m_nEndPos; // end pos of the window + sal_Int32 m_nStartPos; // start pos of the window zero based + sal_Int32 m_nEndPos; // end pos of the window zero based sal_Bool m_bUseEscapeProcessing ; sal_Bool m_bApplyFilter ; @@ -229,14 +229,11 @@ namespace dbaccess void firePropertyChange(sal_Int32 _nColumnIndex,const ::com::sun::star::uno::Any& _rOldValue); void rotateCacheIterator(sal_Int16 _nDist); - -#ifdef DBG_UTIL - void columnModified(sal_Int32 columnIndex); - // for the non-pro version only. This method is called whenever one of the updateXXX methods is invoked. - // This eases tracking column value changes. -#else - #define columnModified(columnIndex) -#endif + void updateValue(sal_Int32 columnIndex,const ORowSetValue& x); + ORowSetValue getValue(sal_Int32 columnIndex); + // checks and set the flags isAfterLast isLast and position when afterlast is true + void checkPositionFlags(); + void checkUpdateConditions(sal_Int32 columnIndex); protected: ORowSetMatrix::iterator& getIterator() { return m_aMatrixIter;} @@ -305,18 +302,6 @@ namespace dbaccess // ::com::sun::star::sdbc::XRowUpdate virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); @@ -373,6 +358,9 @@ namespace dbaccess /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.8 2001/06/26 09:32:05 fs + #88392# added columnModified for diagnostics + Revision 1.7 2001/02/01 14:23:57 oj change for insert , delete and update rows diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx index 83715e1280d8..f8d87795ef0d 100644 --- a/dbaccess/source/core/api/resultset.cxx +++ b/dbaccess/source/core/api/resultset.cxx @@ -2,9 +2,9 @@ * * $RCSfile: resultset.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-21 09:20:13 $ + * last change: $Author: oj $ $Date: 2001-06-26 10:30:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -228,8 +228,7 @@ void OResultSet::close(void) throw( SQLException, RuntimeException ) { { MutexGuard aGuard( m_aMutex ); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); } dispose(); } @@ -339,8 +338,7 @@ void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return Reference< XWarningsSupplier >(m_xAggregateAsResultSet, UNO_QUERY)->getWarnings(); } @@ -349,8 +347,7 @@ Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException ) void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); Reference< XWarningsSupplier >(m_xAggregateAsResultSet, UNO_QUERY)->clearWarnings(); } @@ -360,8 +357,7 @@ void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException ) Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return Reference< XResultSetMetaDataSupplier >(m_xAggregateAsResultSet, UNO_QUERY)->getMetaData(); } @@ -371,8 +367,7 @@ Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLExceptio sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return Reference< XColumnLocate >(m_xAggregateAsResultSet, UNO_QUERY)->findColumn(columnName); } @@ -382,8 +377,7 @@ sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLExce Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); // do we have to populate the columns if (!m_pColumns->isInitialized()) @@ -414,8 +408,7 @@ Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(voi sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->wasNull(); } @@ -423,8 +416,7 @@ sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException ) rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getString(columnIndex); } @@ -432,8 +424,7 @@ rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getBoolean(columnIndex); } @@ -441,8 +432,7 @@ sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, Runt sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getByte(columnIndex); } @@ -450,8 +440,7 @@ sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, Runtime sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getShort(columnIndex); } @@ -459,8 +448,7 @@ sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, Runti sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getInt(columnIndex); } @@ -468,8 +456,7 @@ sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, Runtime sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getLong(columnIndex); } @@ -477,8 +464,7 @@ sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, Runtim float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getFloat(columnIndex); } @@ -486,8 +472,7 @@ float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeEx double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getDouble(columnIndex); } @@ -495,8 +480,7 @@ double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, Runtime Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getBytes(columnIndex); } @@ -504,8 +488,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep ::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getDate(columnIndex); } @@ -513,8 +496,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep ::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getTime(columnIndex); } @@ -522,8 +504,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep ::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getTimestamp(columnIndex); } @@ -531,8 +512,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getBinaryStream(columnIndex); } @@ -540,8 +520,7 @@ Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getCharacterStream(columnIndex); } @@ -549,8 +528,7 @@ Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream( Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getObject(columnIndex, typeMap); } @@ -558,8 +536,7 @@ Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::st Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getRef(columnIndex); } @@ -567,8 +544,7 @@ Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getBlob(columnIndex); } @@ -576,8 +552,7 @@ Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLExcepti Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getClob(columnIndex); } @@ -585,8 +560,7 @@ Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLExcepti Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsRow->getArray(columnIndex); } @@ -596,11 +570,9 @@ Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLExcep void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateNull(columnIndex); } @@ -609,11 +581,9 @@ void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeE void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateBoolean(columnIndex, x); } @@ -621,11 +591,9 @@ void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLExce void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateByte(columnIndex, x); } @@ -633,11 +601,9 @@ void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLExcepti void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateShort(columnIndex, x); } @@ -645,11 +611,9 @@ void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLExcep void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateInt(columnIndex, x); } @@ -657,11 +621,9 @@ void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLExcepti void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateLong(columnIndex, x); } @@ -669,11 +631,9 @@ void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLExcept void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateFloat(columnIndex, x); } @@ -681,11 +641,9 @@ void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateDouble(columnIndex, x); } @@ -693,11 +651,9 @@ void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLExcepti void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateString(columnIndex, x); } @@ -705,11 +661,9 @@ void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) thr void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateBytes(columnIndex, x); } @@ -717,11 +671,9 @@ void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateDate(columnIndex, x); } @@ -729,11 +681,9 @@ void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util: void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateTime(columnIndex, x); } @@ -741,11 +691,9 @@ void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util: void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateTimestamp(columnIndex, x); } @@ -753,11 +701,9 @@ void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star:: void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateBinaryStream(columnIndex, x, length); } @@ -765,11 +711,9 @@ void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::co void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateCharacterStream(columnIndex, x, length); } @@ -777,11 +721,9 @@ void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< : void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateNumericObject(columnIndex, x, scale); } @@ -790,11 +732,9 @@ void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_In void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); m_xAggregateAsRowUpdate->updateObject(columnIndex, x); } @@ -804,8 +744,7 @@ void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLExc sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->next(); } @@ -814,8 +753,7 @@ sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->isBeforeFirst(); } @@ -824,8 +762,7 @@ sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->isAfterLast(); } @@ -834,8 +771,7 @@ sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->isFirst(); } @@ -844,8 +780,7 @@ sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->isLast(); } @@ -854,8 +789,7 @@ sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException ) void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); m_xAggregateAsResultSet->beforeFirst(); } @@ -864,8 +798,7 @@ void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException ) void OResultSet::afterLast(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); m_xAggregateAsResultSet->afterLast(); } @@ -874,8 +807,7 @@ void OResultSet::afterLast(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->first(); } @@ -884,8 +816,7 @@ sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->last(); } @@ -894,8 +825,7 @@ sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException ) sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->getRow(); } @@ -904,8 +834,7 @@ sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->absolute(row); } @@ -914,8 +843,7 @@ sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeExcepti sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->relative(rows); } @@ -924,8 +852,7 @@ sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeExcept sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->previous(); } @@ -934,8 +861,7 @@ sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException ) void OResultSet::refreshRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); m_xAggregateAsResultSet->refreshRow(); } @@ -944,8 +870,7 @@ void OResultSet::refreshRow(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->rowUpdated(); } @@ -954,8 +879,7 @@ sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->rowInserted(); } @@ -964,8 +888,7 @@ sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_xAggregateAsResultSet->rowDeleted(); } @@ -974,8 +897,7 @@ sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException ) Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); return m_aStatement.get(); } @@ -985,11 +907,9 @@ Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, Runt Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->getBookmark(); } @@ -998,11 +918,9 @@ Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException ) sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->moveToBookmark(bookmark); } @@ -1011,10 +929,9 @@ sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, Ru sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); + + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows); } @@ -1023,11 +940,9 @@ sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) sal_Int32 OResultSet::compareBookmarks(const Any& first, const Any& second) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->compareBookmarks(first, second); } @@ -1036,11 +951,9 @@ sal_Int32 OResultSet::compareBookmarks(const Any& first, const Any& second) thro sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->hasOrderedBookmarks(); } @@ -1049,11 +962,9 @@ sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeExcep sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (!m_bIsBookmarkable) - throwFunctionSequenceException(*this); + checkBookmarkable(); return Reference< XRowLocate >(m_xAggregateAsResultSet, UNO_QUERY)->hashBookmark(bookmark); } @@ -1063,11 +974,9 @@ sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, Run void OResultSet::insertRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->insertRow(); } @@ -1076,11 +985,9 @@ void OResultSet::insertRow(void) throw( SQLException, RuntimeException ) void OResultSet::updateRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->updateRow(); } @@ -1089,11 +996,9 @@ void OResultSet::updateRow(void) throw( SQLException, RuntimeException ) void OResultSet::deleteRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->deleteRow(); } @@ -1102,11 +1007,9 @@ void OResultSet::deleteRow(void) throw( SQLException, RuntimeException ) void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->cancelRowUpdates(); } @@ -1115,11 +1018,9 @@ void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException ) void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->moveToInsertRow(); } @@ -1128,12 +1029,23 @@ void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException ) void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); - if (OResultSetBase::rBHelper.bDisposed) - throw DisposedException(); + ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - if (isReadOnly()) - throwFunctionSequenceException(*this); + checkReadOnly(); Reference< XResultSetUpdate >(m_xAggregateAsResultSet, UNO_QUERY)->moveToCurrentRow(); } +// ----------------------------------------------------------------------------- +void OResultSet::checkReadOnly() +{ + if (isReadOnly()) + throwFunctionSequenceException(*this); +} +// ----------------------------------------------------------------------------- +void OResultSet::checkBookmarkable() +{ + if (!m_bIsBookmarkable) + throwFunctionSequenceException(*this); +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/resultset.hxx b/dbaccess/source/core/api/resultset.hxx index 6bbb74c16dff..1d068cf4e573 100644 --- a/dbaccess/source/core/api/resultset.hxx +++ b/dbaccess/source/core/api/resultset.hxx @@ -2,9 +2,9 @@ * * $RCSfile: resultset.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-05-21 09:20:13 $ + * last change: $Author: oj $ $Date: 2001-06-26 10:30:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -295,6 +295,8 @@ namespace dbaccess protected: sal_Bool isReadOnly() const {return m_nResultSetConcurrency == ::com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY;} + void checkReadOnly(); + void checkBookmarkable(); }; } #endif // _DBA_COREAPI_RESULTSET_HXX_ |