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:
Example for usage of TTS:
Custtable custTable;
;
ttsBegin;
select forUpdate custTable where custTable.AccountNum == '4000';
custTable.NameAlias = custTable.Name;
custTable.update();
ttsCommit;
Below statements are used in X++ for the Transaction integrity checking:
- TTSBEGIN - This indicates beginning of a transaction.
- TTSCOMMIT - This indicates the successful completion of a transaction with out any errors and exceptions
- 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.
Example for usage of TTS:
Custtable custTable;
;
ttsBegin;
select forUpdate custTable where custTable.AccountNum == '4000';
custTable.NameAlias = custTable.Name;
custTable.update();
ttsCommit;
No comments:
Post a Comment