Transaction Notifications

Overview

Database events are not sent to observers during a transaction. Instead, they are queued by the server and only sent once the transaction is committed. If the transaction is cancelled (if a rollback occurs) then none of the queued events will be sent to observers apart from the EContactDbObserverEventRollback event.

Transaction Related APIs

The behaviour described above comes into effect when using the following APIs:

  • void CContactDatabase::DatabaseBeginL(…)

  • void CContactDatabase::DatabaseBeginLC(…)

  • void CContactDatabase::DatabaseCommitL(…)

  • void CContactDatabase::DatabaseCommitLP(…)

  • void CContactDatabase::DeleteContactsL(…)

  • void CContactDatabase::DatabaseRollback()

Implementation Considerations

A maximum of 1000 database events will be queued during a transaction. If there are more events than this then the queued events will be discarded. When the transaction is committed the EContactDbObserverEventUnknownChanges event will be sent to observers instead.

It is important to note that in the previous version of the Contacts Model database events were sent to observers as they occurred during a transaction. The new model behaviour is more appropriate since, when a rollback occurs, there is no point in receiving events for operations which never actually happened (that is, were not committed).