if ( isRowSetListening() )
{ // we're listening at the row set, this means that the row set does not have our // m_xOriginalConnection as active connection anymore // So there are two possibilities // a. somebody sets a new connection which is not our original one // b. somebody sets a new connection, which is exactly the original one // a. we're not interested in a, but in b: In this case, we simply need to move to the state // we had originally: listen for property changes, do not listen for row set changes, and // do not dispose the connection until the row set does not need it anymore if ( xNewConnection.get() == m_xOriginalConnection.get() )
{
stopRowSetListening();
}
} else
{ // start listening at the row set. We're allowed to dispose the old connection as soon // as the RowSet changed
// Unfortunately, the our database form implementations sometimes fire the change of their // ActiveConnection twice. This is an error in forms/source/component/DatabaseForm.cxx, but // changing this would require incompatible changes we can't do for a while. // So for the moment, we have to live with it here. // // The only scenario where this doubled notification causes problems is when the connection // of the form is reset to the one we're responsible for (m_xOriginalConnection), so we // check this here. // // Yes, this is a HACK :( if ( xNewConnection.get() != m_xOriginalConnection.get() )
{ #if OSL_DEBUG_LEVEL > 0
Reference< XConnection > xOldConnection;
_rEvent.OldValue >>= xOldConnection;
OSL_ENSURE( xOldConnection.get() == m_xOriginalConnection.get(), "OAutoConnectionDisposer::propertyChange: unexpected (original) property value!" ); #endif
startRowSetListening();
}
}
}
void SAL_CALL OAutoConnectionDisposer::disposing( const EventObject& _rSource )
{ // the rowset is being disposed, and nobody has set a new ActiveConnection in the meantime if ( isRowSetListening() )
stopRowSetListening();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.