Maintaining row state information is a powerful part of the UltraLite feature set. Tracking the state of tables and rows is particularly important for data synchronization.
Each row in an UltraLite database uses a small internal marker to keep track of the state of the row. The row states are used to control transaction processing, recovery, and synchronization. When a row is inserted, updated, or deleted in an UltraLite database, the state of the row is modified to reflect the operation and the connection that performed the operation. When a transaction is committed, the states of all rows affected by the transaction are modified to reflect the commit. If an unexpected failure occurs during a commit, the entire transaction is rolled back. The following list summarizes these behaviors:
When a delete is issued The state of each affected row is changed to reflect the fact that it was deleted. Rolling back a delete is as simple as restoring the original state of the row.
When a delete is committed The affected rows are not always removed from memory. If the row has never been synchronized, then it is removed. If the row has been synchronized, then it is not removed, because the delete operation needs to be synchronized to the consolidated database first. After the next synchronization, the row is removed from memory.
When a row is updated A new version of the row is created. The states of the old and new rows are set so the old row is no longer visible and the new row is visible.
When a row update is committed When a transaction is committed, the states of all rows affected by the transaction are modified to reflect the commit. When an update is synchronized, both the old and new versions of the row are needed to allow conflict detection and resolution. The old row is then deleted from the database and the new row simply becomes a normal row.
When a row is added The row is added to the database and is marked as not committed.
When an added row is committed The row is marked as committed and is also flagged as requiring synchronization with the consolidated database.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |