Tag: cws_src680_dba202f User: oj Date: 06/01/30 01:14:05 Modified: /dba/dbaccess/source/core/api/ CRowSetColumn.cxx, CRowSetColumn.hxx, CRowSetDataColumn.cxx, CRowSetDataColumn.hxx, RowSet.cxx, RowSetBase.cxx, RowSetBase.hxx, RowSetCache.cxx, RowSetCache.hxx, RowSetCacheIterator.cxx, RowSetCacheIterator.hxx
Log: #i61052# fix for updates, deletes and moves File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: CRowSetColumn.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/CRowSetColumn.cxx?r1=1.13.14.1&r2=1.13.14.2 Delta lines: +2 -2 ------------------- --- CRowSetColumn.cxx 20 Jan 2006 14:51:38 -0000 1.13.14.1 +++ CRowSetColumn.cxx 30 Jan 2006 09:12:57 -0000 1.13.14.2 @@ -4,9 +4,9 @@ * * $RCSfile: CRowSetColumn.cxx,v $ * - * $Revision: 1.13.14.1 $ + * $Revision: 1.13.14.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:38 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:12:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. File [changed]: CRowSetColumn.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/CRowSetColumn.hxx?r1=1.8.14.1&r2=1.8.14.2 Delta lines: +2 -2 ------------------- --- CRowSetColumn.hxx 20 Jan 2006 14:51:39 -0000 1.8.14.1 +++ CRowSetColumn.hxx 30 Jan 2006 09:13:40 -0000 1.8.14.2 @@ -4,9 +4,9 @@ * * $RCSfile: CRowSetColumn.hxx,v $ * - * $Revision: 1.8.14.1 $ + * $Revision: 1.8.14.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:39 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:40 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. File [changed]: CRowSetDataColumn.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/CRowSetDataColumn.cxx?r1=1.30.14.1&r2=1.30.14.2 Delta lines: +6 -2 ------------------- --- CRowSetDataColumn.cxx 20 Jan 2006 14:51:41 -0000 1.30.14.1 +++ CRowSetDataColumn.cxx 30 Jan 2006 09:13:53 -0000 1.30.14.2 @@ -4,9 +4,9 @@ * * $RCSfile: CRowSetDataColumn.cxx,v $ * - * $Revision: 1.30.14.1 $ + * $Revision: 1.30.14.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:41 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -155,7 +155,11 @@ case PROPERTY_ID_VALUE: if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() ) { + ::osl::Mutex* pMutex = m_aColumnValue.getMutex(); + ::osl::MutexGuard aGuard( *pMutex ); +#if OSL_DEBUG_LEVEL > 1 ORowSetRow aRow = *m_aColumnValue; +#endif OSL_ENSURE((sal_Int32)aRow->size() > m_nPos,"Pos is greater than size of vector"); rValue = (*(*m_aColumnValue))[m_nPos].makeAny(); } File [changed]: CRowSetDataColumn.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/CRowSetDataColumn.hxx?r1=1.14.14.1&r2=1.14.14.2 Delta lines: +2 -2 ------------------- --- CRowSetDataColumn.hxx 20 Jan 2006 14:51:42 -0000 1.14.14.1 +++ CRowSetDataColumn.hxx 30 Jan 2006 09:13:55 -0000 1.14.14.2 @@ -4,9 +4,9 @@ * * $RCSfile: CRowSetDataColumn.hxx,v $ * - * $Revision: 1.14.14.1 $ + * $Revision: 1.14.14.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:42 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:55 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. File [changed]: RowSet.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSet.cxx?r1=1.139.12.2&r2=1.139.12.3 Delta lines: +39 -40 --------------------- --- RowSet.cxx 27 Jan 2006 06:53:23 -0000 1.139.12.2 +++ RowSet.cxx 30 Jan 2006 09:13:56 -0000 1.139.12.3 @@ -4,9 +4,9 @@ * * $RCSfile: RowSet.cxx,v $ * - * $Revision: 1.139.12.2 $ + * $Revision: 1.139.12.3 $ * - * last change: $Author: fs $ $Date: 2006/01/27 06:53:23 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1005,6 +1005,7 @@ // when the row isn't modified // or the concurency is read only ::osl::ResettableMutexGuard aGuard( *m_pMutex ); + if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) throwFunctionSequenceException(*this); @@ -1019,7 +1020,6 @@ RowChangeEvent aEvt(*this,RowChangeAction::INSERT,1); notifyAllListenersRowBeforeChange(aGuard,aEvt); - ::osl::MutexGuard aCacheGuard( *m_pMutex); sal_Bool bInserted = m_pCache->insertRow(); // make sure that our row is set to the new inserted row before clearing the insert flags in the cache @@ -1048,11 +1048,11 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); // check if we are inserting a row - return (m_pCache && ( m_pCache->m_bInserted || m_bModified )) ? 0 : ORowSetBase::getRow(); + return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) @@ -1063,6 +1063,7 @@ if ( !m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY || m_bNew || ((m_pCache->m_nPrivileges & Privilege::UPDATE ) != Privilege::UPDATE) ) throwFunctionSequenceException(*this); + if(m_bModified) { ORowSetRow aOldValues; @@ -1111,7 +1112,6 @@ // this call position the cache indirect Any aBookmarkToDelete( m_aBookmark ); - positionCache( MOVE_NONE_REFRESH_ONLY ); sal_Int32 nDeletePosition = m_pCache->getRow(); @@ -1207,18 +1207,24 @@ void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) { EventObject aEvt(*m_pMySelf); + _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt ); + _rGuard.reset(); } // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) { EventObject aEvt(*m_pMySelf); + _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt ); + _rGuard.reset(); } // ------------------------------------------------------------------------- void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const EventObject& aEvt) { + _rGuard.clear(); m_aRowsetListeners.notifyEach( &XRowSetListener::rowChanged, aEvt ); + _rGuard.reset(); } // ------------------------------------------------------------------------- sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) @@ -1272,12 +1278,11 @@ { // remember old value for fire ORowSetRow aOldValues; - if ( rowDeleted() ) { positionCache( MOVE_FORWARD ); m_pCache->next(); - setCurrentRow( sal_True, sal_False, aOldValues, aGuard ); + setCurrentRow( sal_True, sal_False, aOldValues, aGuard); } else positionCache( MOVE_NONE_REFRESH_ONLY ); @@ -1323,7 +1328,7 @@ ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); - if ( !m_pCache->m_bInserted && !m_bModified ) + if ( !m_pCache->m_bNew && !m_bModified ) // nothing to do if we're not on the insertion row, and not modified otherwise return; @@ -1338,10 +1343,8 @@ if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { positionCache( MOVE_NONE_REFRESH_ONLY ); - m_pCache->moveToCurrentRow(); ORowSetNotifier aNotifier( this ); - // this will call cancelRowModification on the cache if necessary // notification order // - cursorMoved @@ -1359,15 +1362,14 @@ ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - return ( m_pCache && ( m_pCache->m_bInserted || m_bModified ) ) ? (*(*m_pCache->m_aInsertRow))[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull(); + return ( m_pCache && isInsertRow() ) ? (*(*m_pCache->m_aInsertRow))[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull(); } // ----------------------------------------------------------------------------- const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex) { - ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - if ( m_pCache && ( m_pCache->m_bInserted || m_bModified) ) + if ( m_pCache && isInsertRow() ) return (*(*m_pCache->m_aInsertRow))[m_nLastColumnIndex = columnIndex]; return getValue(columnIndex); @@ -1375,68 +1377,80 @@ // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); - if(m_pCache && ( m_pCache->m_bInserted || m_bModified )) + if ( m_pCache && isInsertRow() ) { checkCache(); return new ::comphelper::SequenceInputStream((*(*m_pCache->m_aInsertRow))[m_nLastColumnIndex = columnIndex].getSequence()); @@ -1448,7 +1462,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); - if(m_pCache && ( m_pCache->m_bInserted || m_bModified )) + if(m_pCache && isInsertRow() ) { checkCache(); return new ::comphelper::SequenceInputStream((*(*m_pCache->m_aInsertRow))[m_nLastColumnIndex = columnIndex].getSequence()); @@ -1459,41 +1473,26 @@ // ------------------------------------------------------------------------- Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); - return Any(); } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); - return Reference< XRef >(); } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); - return Reference< XBlob >(); } // ------------------------------------------------------------------------- Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); - return Reference< XClob >(); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); - return Reference< XArray >(); } // ------------------------------------------------------------------------- @@ -1909,7 +1908,6 @@ } } checkCache(); - _rClearForNotification.clear(); // notify the rowset listeners notifyAllListeners(_rClearForNotification); } @@ -1989,17 +1987,14 @@ if ( !m_pCache->deleteRow() ) continue; *result = 1; - // now notify that we have deleted notifyRowSetAndClonesRowDeleted( *row, nDeletePosition ); } - aEvt.Rows = aResults.getLength(); // we have to check if we stand on the insert row and if so we have to reset it ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary - // notification order // - rowChanged notifyAllListenersRowChanged(aGuard,aEvt); @@ -2471,7 +2466,7 @@ // ----------------------------------------------------------------------------- sal_Bool ORowSet::isModification( ) { - return m_pCache && m_pCache->m_bInserted; + return m_pCache && m_pCache->m_bNew; } // ----------------------------------------------------------------------------- @@ -2493,7 +2488,10 @@ { m_pCache->setUpdateIterator(m_aCurrentRow); m_aCurrentRow = m_pCache->m_aInsertRow; - } + m_bModified = sal_True; + } // if(!m_bModified && !m_bNew) + else if ( m_bNew ) // here we are modifing a value + m_bModified = sal_True; } // ----------------------------------------------------------------------------- void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) @@ -2511,6 +2509,7 @@ // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) { + ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary File [changed]: RowSetBase.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetBase.cxx?r1=1.80.8.2&r2=1.80.8.3 Delta lines: +76 -44 --------------------- --- RowSetBase.cxx 27 Jan 2006 06:53:42 -0000 1.80.8.2 +++ RowSetBase.cxx 30 Jan 2006 09:13:58 -0000 1.80.8.3 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetBase.cxx,v $ * - * $Revision: 1.80.8.2 $ + * $Revision: 1.80.8.3 $ * - * last change: $Author: fs $ $Date: 2006/01/27 06:53:42 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -80,7 +80,9 @@ #ifndef _CONNECTIVITY_EMPTYMETADATA_HXX_ #include <connectivity/emptymetadata.hxx> #endif - +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif @@ -243,6 +245,7 @@ ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); + return ((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid()) ? (*(*m_aCurrentRow))[m_nLastColumnIndex].isNull() : sal_True; } // ----------------------------------------------------------------------------- @@ -250,8 +253,10 @@ // ----------------------------------------------------------------------------- const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) { - ::osl::MutexGuard aGuard( *m_pMutex ); + 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)!"); @@ -259,7 +264,10 @@ } if ( rowDeleted() ) + { + DBG_TRACE2("DBACCESS ORowSetBase::getValue() Clone = %i rowDeleted() ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); return m_aEmptyValue; + } bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); if ( !bValidCurrentRow ) @@ -282,67 +290,80 @@ 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; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -351,6 +372,7 @@ ::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 @@ -422,7 +444,7 @@ // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::getBookmark() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::getBookmark() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -439,7 +461,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::moveToBookmark(Any) Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::moveToBookmark(Any) Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(bookmark.hasValue(),"ORowSetBase::moveToBookmark bookmark has no value!"); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -459,7 +481,7 @@ if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -501,7 +523,7 @@ if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -598,7 +620,7 @@ // XResultSet sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::next() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::next() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkCache(); @@ -606,7 +628,7 @@ if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -641,7 +663,7 @@ // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE2("DBACCESS ORowSetBase::next() = %i Clone = %i\n",bRet,m_bClone); + DBG_TRACE3("DBACCESS ORowSetBase::next() = %i Clone = %i ID = %i\n",bRet,m_bClone,osl_getThreadIdentifier(NULL)); return bRet; } // ------------------------------------------------------------------------- @@ -673,7 +695,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::isFirst() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::isFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -699,7 +721,7 @@ // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::isLast() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::isLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -722,14 +744,14 @@ // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::beforeFirst() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); if((bWasNew || !m_bBeforeFirst) && notifyAllListenersCursorBeforeMove(aGuard) ) { @@ -758,18 +780,18 @@ // to be done _after_ the notifications! m_aOldRow->clearRow(); } - DBG_TRACE1("DBACCESS ORowSetBase::beforeFirst() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ------------------------------------------------------------------------- void SAL_CALL ORowSetBase::afterLast( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::afterLast() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); if((bWasNew || !m_bAfterLast) && notifyAllListenersCursorBeforeMove(aGuard) ) { @@ -797,13 +819,13 @@ fireRowcount(); } } - DBG_TRACE1("DBACCESS ORowSetBase::afterLast() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aCheckFunctor, ::std::mem_fun_t<sal_Bool,ORowSetCache>& _aMovementFunctor) { - DBG_TRACE1("DBACCESS ORowSetBase::move() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::move() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); @@ -812,7 +834,7 @@ if(bRet = notifyAllListenersCursorBeforeMove(aGuard) ) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -849,7 +871,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::first( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::first() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::first() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioF_tmp(&ORowSetBase::isOnFirst); ::std::mem_fun_t<sal_Bool,ORowSetCache> F_tmp(&ORowSetCache::first); return move(ioF_tmp,F_tmp); @@ -857,7 +879,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::last( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::last() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::last() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioL_tmp(&ORowSetBase::isOnLast); ::std::mem_fun_t<sal_Bool,ORowSetCache> L_tmp(&ORowSetCache::last); return move(ioL_tmp,L_tmp); @@ -865,10 +887,12 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSetBase::getRow( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::getRow() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::getRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::MutexGuard aGuard( *m_pMutex ); + checkCache(); + sal_Int32 nPos = 0; if ( m_bBeforeFirst ) nPos = 0; @@ -876,7 +900,7 @@ nPos = impl_getRowCount() + 1; else if ( rowDeleted() ) nPos = m_nDeletedPosition; - else if ( !m_bClone && m_pCache->m_bInserted ) + else if ( !m_bClone && m_pCache->m_bNew ) nPos = 0; else { @@ -889,7 +913,7 @@ } nPos = m_pCache->getRow(); } - DBG_TRACE2("DBACCESS ORowSetBase::getRow() = %i Clone = %i\n",nPos,m_bClone); + DBG_TRACE3("DBACCESS ORowSetBase::getRow() = %i Clone = %i ID = %i\n",nPos,m_bClone,osl_getThreadIdentifier(NULL)); return nPos; } // ------------------------------------------------------------------------- @@ -904,7 +928,7 @@ if ( bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard)) ) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -955,7 +979,7 @@ if(bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard))) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -991,7 +1015,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException) { - DBG_TRACE1("DBACCESS ORowSetBase::previous() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::previous() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1002,7 +1026,7 @@ if(bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard))) { // check if we are inserting a row - sal_Bool bWasNew = m_pCache->m_bInserted || rowDeleted(); + sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -1042,7 +1066,7 @@ // ----------------------------------------------------------------------------- void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard ) { - DBG_TRACE1("DBACCESS ORowSetBase::setCurrentRow() Clone = %i",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_bBeforeFirst = m_pCache->isBeforeFirst(); m_bAfterLast = m_pCache->isAfterLast(); //m_pCache->resetInsertRow(sal_True); @@ -1095,7 +1119,7 @@ // - cursorMoved notifyAllListenersCursorMoved( _rGuard ); - DBG_TRACE1("DBACCESS ORowSetBase::setCurrentRow() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ----------------------------------------------------------------------------- void ORowSetBase::checkPositioningAllowed() throw( SQLException, RuntimeException ) @@ -1114,7 +1138,6 @@ ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - if ( rowDeleted() ) throwSQLException( "The current row is deleted", SQL_INVALID_CURSOR_STATE, Reference< XRowSet >( this ) ); @@ -1130,6 +1153,10 @@ ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); + + if ( rowDeleted() ) + return sal_False; + if ( rowDeleted() ) return sal_False; @@ -1139,8 +1166,13 @@ sal_Bool SAL_CALL ORowSetBase::rowInserted( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); + checkCache(); + + if ( rowDeleted() ) + return sal_False; + if ( rowDeleted() ) return sal_False; @@ -1173,6 +1205,7 @@ ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); + Reference< XWarningsSupplier > xWarnings( m_pCache->m_xSet.get(), UNO_QUERY ); if ( xWarnings.is() ) xWarnings->clearWarnings(); @@ -1180,7 +1213,7 @@ // ------------------------------------------------------------------------- void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) { - DBG_TRACE1("DBACCESS ORowSetBase::firePropertyChange() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(m_pColumns,"Columns can not be NULL here!"); #if OSL_DEBUG_LEVEL > 1 sal_Bool bNull = m_aCurrentRow.isNull(); @@ -1196,13 +1229,13 @@ { OSL_ENSURE(0,"firePropertyChange: Exception"); } - DBG_TRACE1("DBACCESS ORowSetBase::firePropertyChange() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ----------------------------------------------------------------------------- sal_Bool ORowSetBase::isModification( ) { - return m_pCache && m_pCache->m_bInserted; + return m_pCache && m_pCache->m_bNew; } // ----------------------------------------------------------------------------- @@ -1216,7 +1249,7 @@ // ----------------------------------------------------------------------------- void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection ) { - DBG_TRACE1("DBACCESS ORowSetBase::positionCache() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); sal_Bool bSuccess = sal_False; if ( m_aBookmark.hasValue() ) @@ -1266,7 +1299,7 @@ } OSL_ENSURE( bSuccess, "ORowSetBase::positionCache: failed!" ); - DBG_TRACE1("DBACCESS ORowSetBase::positionCache() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ----------------------------------------------------------------------------- void ORowSetBase::checkCache() @@ -1278,7 +1311,7 @@ // ----------------------------------------------------------------------------- void ORowSetBase::movementFailed() { - DBG_TRACE1("DBACCESS ORowSetBase::movementFailed() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_aOldRow->clearRow(); m_aCurrentRow = m_pCache->getEnd(); m_bBeforeFirst = m_pCache->isBeforeFirst(); @@ -1286,7 +1319,7 @@ m_aBookmark = Any(); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE(m_bBeforeFirst || m_bAfterLast,"BeforeFirst or AfterLast is wrong!"); - DBG_TRACE1("DBACCESS ORowSetBase::movementFailed() Clone = %i\n",m_bClone); + DBG_TRACE2("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } // ----------------------------------------------------------------------------- ORowSetRow ORowSetBase::getOldRow(sal_Bool _bWasNew) @@ -1343,11 +1376,10 @@ sal_Int32 ORowSetBase::impl_getRowCount() const { sal_Int32 nRowCount( m_pCache->m_nRowCount ); - if ( const_cast< ORowSetBase* >( this )->rowDeleted() && !m_pCache->m_bInserted ) + if ( const_cast< ORowSetBase* >( this )->rowDeleted() && !m_pCache->m_bNew ) ++nRowCount; return nRowCount; } - // ============================================================================= DBG_NAME(ORowSetNotifier) // ----------------------------------------------------------------------------- File [changed]: RowSetBase.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetBase.hxx?r1=1.32.70.2&r2=1.32.70.3 Delta lines: +5 -3 ------------------- --- RowSetBase.hxx 27 Jan 2006 06:53:51 -0000 1.32.70.2 +++ RowSetBase.hxx 30 Jan 2006 09:13:59 -0000 1.32.70.3 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetBase.hxx,v $ * - * $Revision: 1.32.70.2 $ + * $Revision: 1.32.70.3 $ * - * last change: $Author: fs $ $Date: 2006/01/27 06:53:51 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:13:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -369,6 +369,8 @@ { fireProperty( _nProperty, _bNew, _bOld ); } + + ::osl::Mutex* getMutex() const { return m_pMutex; } }; // ======================================================================== File [changed]: RowSetCache.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.cxx?r1=1.80.8.3&r2=1.80.8.4 Delta lines: +33 -71 --------------------- --- RowSetCache.cxx 27 Jan 2006 09:17:28 -0000 1.80.8.3 +++ RowSetCache.cxx 30 Jan 2006 09:14:00 -0000 1.80.8.4 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetCache.cxx,v $ * - * $Revision: 1.80.8.3 $ + * $Revision: 1.80.8.4 $ * - * last change: $Author: fs $ $Date: 2006/01/27 09:17:28 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:14:00 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -144,7 +144,6 @@ ,m_bBeforeFirst(sal_True) ,m_bAfterLast( sal_False ) ,m_bRowCountFinal(sal_False) - ,m_bInserted(sal_False) ,m_bUpdated(sal_False) ,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData()) ,m_xServiceFactory(_xServiceFactory) @@ -391,6 +390,7 @@ // ------------------------------------------------------------------------- void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) { + if(_nSize == m_nFetchSize) return; @@ -415,7 +415,7 @@ { aCacheIterToChange[aCacheIter->first] = sal_False; if ( !aCacheIter->second.pRowSet->isInsertRow() - && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bInserted && !m_bModified ) + && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); aPositions.push_back(nDist); @@ -457,6 +457,7 @@ // ::com::sun::star::sdbcx::XRowLocate Any ORowSetCache::getBookmark( ) { + if(m_bAfterLast) throwFunctionSequenceException(m_xSet.get()); @@ -511,6 +512,7 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) { + sal_Bool bRet; if(bRet = moveToBookmark(bookmark)) { @@ -531,11 +533,13 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::hasOrderedBookmarks( ) { + return m_pCacheSet->hasOrderedBookmarks(); } // ------------------------------------------------------------------------- sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark ) { + return m_pCacheSet->hashBookmark(bookmark); } // ------------------------------------------------------------------------- @@ -545,18 +549,17 @@ { 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; } // ------------------------------------------------------------------------- void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) { checkUpdateConditions(columnIndex); - ::osl::MutexGuard aGuard( m_aColumnsMutex ); + Sequence<sal_Int8> aSeq; if(x.is()) x->readSomeBytes(aSeq,length); @@ -567,7 +570,7 @@ { checkUpdateConditions(columnIndex); - ::osl::MutexGuard aGuard( m_aColumnsMutex ); + Sequence<sal_Int8> aSeq; if(x.is()) x->readSomeBytes(aSeq,length); @@ -579,29 +582,26 @@ { 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; } // ------------------------------------------------------------------------- void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) { 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; - } // ------------------------------------------------------------------------- // XResultSet sal_Bool ORowSetCache::next( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + if(!isAfterLast()) { @@ -626,34 +626,32 @@ sal_Bool ORowSetCache::isBeforeFirst( ) { // return !m_nPosition; - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + return m_bBeforeFirst; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isAfterLast( ) { - // return m_pCacheSet->isAfterLast(); - // return m_bRowCountFinal ? m_bAfterLast : m_pCacheSet->isAfterLast(); - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + return m_bAfterLast; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isFirst( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + return m_nPosition == 1; // ask resultset for } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isLast( ) { // return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast(); - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + return m_nPosition == m_nRowCount; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::beforeFirst( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + if(!m_bBeforeFirst) { @@ -669,7 +667,7 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::afterLast( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); + if(!m_bAfterLast) { @@ -761,6 +759,7 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::moveWindow() { + sal_Bool bRet = sal_True; sal_Int32 nDiff = (sal_Int32)(m_nFetchSize*0.5 -0.5); @@ -813,7 +812,7 @@ for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) { if ( !aCacheIter->second.pRowSet->isInsertRow() - && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bInserted && !m_bModified ) + && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); if ( nDist >= nNewDist ) @@ -847,6 +846,8 @@ { m_nStartPos = 0; + rotateCacheIterator(static_cast<sal_Int16>(m_nFetchSize+1)); // static_cast<sal_Int16>(m_nFetchSize+1) + m_pCacheSet->beforeFirst(); sal_Bool bCheck; @@ -861,7 +862,6 @@ } else *aIter = NULL; - } } else @@ -986,8 +986,6 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::first( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - // 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 @@ -1005,7 +1003,7 @@ m_bRowCountFinal = m_bBeforeFirst = m_bAfterLast = sal_True; m_nRowCount = m_nPosition = 0; - OSL_ENSURE(m_bBeforeFirst || (m_bNew && m_bInserted),"ORowSetCache::first return false and BeforeFirst isn't true"); + OSL_ENSURE(m_bBeforeFirst || m_bNew,"ORowSetCache::first return false and BeforeFirst isn't true"); m_aMatrixIter = m_pMatrix->end(); } return bRet; @@ -1013,8 +1011,6 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::last( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - sal_Bool bRet = m_pCacheSet->last(); if(bRet) { @@ -1054,15 +1050,11 @@ // ------------------------------------------------------------------------- sal_Int32 ORowSetCache::getRow( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::absolute( sal_Int32 row ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(!row ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_ABS_ZERO),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1116,8 +1108,6 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::relative( sal_Int32 rows ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - sal_Bool bErg = sal_True; if(rows) { @@ -1130,7 +1120,6 @@ else if ( m_bBeforeFirst || ( m_bRowCountFinal && m_bAfterLast ) ) throw SQLException( DBACORE_RESSTRING( RID_STR_NO_RELATIVE ), NULL, SQLSTATE_GENERAL, 1000, Any() ); - if ( nNewPosition ) { bErg = absolute( nNewPosition ); @@ -1147,8 +1136,6 @@ // ------------------------------------------------------------------------- sal_Bool ORowSetCache::previous( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - sal_Bool bRet = sal_False; if(!isBeforeFirst()) { @@ -1180,14 +1167,12 @@ // ------------------------------------------------------------------------- void ORowSetCache::refreshRow( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(isAfterLast()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_REFESH_AFTERLAST),NULL,SQLSTATE_GENERAL,1000,Any() ); OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"refreshRow() called for invalid row!"); m_pCacheSet->refreshRow(); m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition); - if ( m_bInserted ) + if ( m_bNew ) { cancelRowModification(); } @@ -1206,9 +1191,7 @@ // XResultSetUpdate sal_Bool ORowSetCache::insertRow( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - - if ( !m_bInserted || !m_aInsertRow->isValid() ) + if ( !m_bNew || !m_aInsertRow->isValid() ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() ); sal_Bool bRet; @@ -1235,7 +1218,6 @@ clearInsertRow(); m_bNew = sal_False; m_bModified = sal_False; - m_bInserted = sal_False; } // ------------------------------------------------------------------------- void ORowSetCache::cancelRowModification() @@ -1253,8 +1235,6 @@ // ------------------------------------------------------------------------- void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(isAfterLast() || isBeforeFirst()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_UPDATEROW),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1278,8 +1258,6 @@ // ------------------------------------------------------------------------- bool ORowSetCache::deleteRow( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - if(isAfterLast() || isBeforeFirst()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_DELETEROW),NULL,SQLSTATE_GENERAL,1000,Any() ); @@ -1308,9 +1286,7 @@ // ------------------------------------------------------------------------- void ORowSetCache::cancelRowUpdates( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - - m_bNew = m_bInserted = m_bModified = sal_False; + m_bNew = m_bModified = sal_False; if(!m_nPosition) { OSL_ENSURE(0,"cancelRowUpdates:Invalid positions pos == 0"); @@ -1328,10 +1304,7 @@ // ------------------------------------------------------------------------- void ORowSetCache::moveToInsertRow( ) { - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - m_bNew = sal_True; - m_bInserted = sal_True; m_bUpdated = m_bAfterLast = sal_False; m_aInsertRow = m_pInsertMatrix->begin(); @@ -1348,20 +1321,9 @@ } } // ------------------------------------------------------------------------- -void ORowSetCache::moveToCurrentRow( ) -{ - ::osl::MutexGuard aGuard( m_aRowCountMutex ); - -// if(m_bInserted) -// { -// m_pCacheSet->moveToCurrentRow(); -// m_bInserted = sal_False; -// } -} - -// ------------------------------------------------------------------------- ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet) { + ORowSetCacheIterator_Helper aHelper; aHelper.aIterator = m_pMatrix->end(); aHelper.pRowSet = _pRowSet; @@ -1377,7 +1339,7 @@ for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) { if ( !aCacheIter->second.pRowSet->isInsertRow() - && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bInserted && !m_bModified ) + && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); if(nDist < _nDist) File [changed]: RowSetCache.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.hxx?r1=1.25.72.2&r2=1.25.72.3 Delta lines: +6 -13 -------------------- --- RowSetCache.hxx 27 Jan 2006 06:54:10 -0000 1.25.72.2 +++ RowSetCache.hxx 30 Jan 2006 09:14:01 -0000 1.25.72.3 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetCache.hxx,v $ * - * $Revision: 1.25.72.2 $ + * $Revision: 1.25.72.3 $ * - * last change: $Author: fs $ $Date: 2006/01/27 06:54:10 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:14:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -120,11 +120,6 @@ typedef ::std::vector< TORowSetOldRowHelperRef > TOldRowSetRows; - ::osl::Mutex m_aRowCountMutex, // mutex for rowcount changes - // we need a extra mutex for columns to prevend deadlock when setting new values - // for a row - m_aColumnsMutex; - //the set can be static, bookmarkable or keyset ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xSet; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; // must be before m_aInsertRow @@ -158,7 +153,6 @@ sal_Bool m_bRowCountFinal ; sal_Bool m_bBeforeFirst ; sal_Bool m_bAfterLast ; - sal_Bool m_bInserted; sal_Bool m_bUpdated ; sal_Bool& m_bModified ; // points to the rowset member m_bModified sal_Bool& m_bNew ; // points to the rowset member m_bNew @@ -254,7 +248,6 @@ bool deleteRow(); void cancelRowUpdates( ); void moveToInsertRow( ); - void moveToCurrentRow( ); }; } #endif File [changed]: RowSetCacheIterator.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCacheIterator.cxx?r1=1.10.4.1&r2=1.10.4.2 Delta lines: +7 -3 ------------------- --- RowSetCacheIterator.cxx 20 Jan 2006 14:51:47 -0000 1.10.4.1 +++ RowSetCacheIterator.cxx 30 Jan 2006 09:14:02 -0000 1.10.4.2 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetCacheIterator.cxx,v $ * - * $Revision: 1.10.4.1 $ + * $Revision: 1.10.4.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:47 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:14:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -140,5 +140,9 @@ ); } return bRet; - +} +// ----------------------------------------------------------------------------- +::osl::Mutex* ORowSetCacheIterator::getMutex() const +{ + return m_pRowSet ? m_pRowSet->getMutex() : NULL; } File [changed]: RowSetCacheIterator.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCacheIterator.hxx?r1=1.7.72.1&r2=1.7.72.2 Delta lines: +3 -2 ------------------- --- RowSetCacheIterator.hxx 20 Jan 2006 14:51:48 -0000 1.7.72.1 +++ RowSetCacheIterator.hxx 30 Jan 2006 09:14:02 -0000 1.7.72.2 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetCacheIterator.hxx,v $ * - * $Revision: 1.7.72.1 $ + * $Revision: 1.7.72.2 $ * - * last change: $Author: fs $ $Date: 2006/01/20 14:51:48 $ + * last change: $Author: oj $ $Date: 2006/01/30 09:14:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -89,6 +89,7 @@ void setBookmark(const ::com::sun::star::uno::Any& _rBookmark); ::com::sun::star::uno::Any getBookmark() const { return m_aIter->second.aBookmark; } + ::osl::Mutex* getMutex() const; }; } #endif // DBACCESS_ROWSETCACHEITERATOR_HXX --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
