Thursday, October 11, 2012

Transaction integrity checking- TTS in Axapta

The database transactions in any system should be consistent and should have predictable results. There should be integrity or check whether we successfully completed our transaction. If the transaction causes and error/exception it must be able to roll back to the state before starting the transaction.
Below statements are used in X++ for the Transaction integrity checking:
  1. TTSBEGIN - This indicates beginning of a transaction.
  2. TTSCOMMIT - This indicates the successful completion of a transaction with out any errors and exceptions
  3. TTSABORT - This statement is used as an exception when something goes wrong in the trasaction. This statement rolls back the database transaction to the state before TTSBEGIN. This statement is automatically called by the system in case of exceptions.
AX keeps track of the Nested TTS statements by using a level counter which is incremented by one for each TTSBEGIN and decremented by one for each TTS COMMIT

Example for usage of TTS:
Custtable custTable;

select forUpdate custTable where custTable.AccountNum == '4000';
custTable.NameAlias = custTable.Name;


No comments:

Post a Comment