Difference between revisions of "BEGIN TRANSACTION"
m (Text replace - "Recital" to "Lianja") |
Yvonne.milne (Talk | contribs) |
||
Line 15: | Line 15: | ||
The BEGIN TRANSACTION command is used to flag the beginning of a transaction for Before Image Journaling (BIJ). A 'transaction' consists of all file modifications that occur within the commands BEGIN TRANSACTION and END TRANSACTION. | The BEGIN TRANSACTION command is used to flag the beginning of a transaction for Before Image Journaling (BIJ). A 'transaction' consists of all file modifications that occur within the commands BEGIN TRANSACTION and END TRANSACTION. | ||
− | When BEGIN TRANSACTION is issued all currently open files and all files opened between BEGIN and END TRANSACTION will have BIJ invoked automatically. If BIJ is not required on a particular table then the RESET IN command should be issued for the relevant workarea so that journaling will no longer occur in that workarea. The journals are stored in a log file (with a file extension of '.log') which | + | When BEGIN TRANSACTION is issued all currently open files and all files opened between BEGIN and END TRANSACTION will have BIJ invoked automatically. If BIJ is not required on a particular table then the RESET IN command should be issued for the relevant workarea so that journaling will no longer occur in that workarea. The journals are stored in a log file (with a file extension of '.log') which is generated automatically. You can optionally specify the disk and directory <path name> where the log file will be stored when the BEGIN TRANSACTION command is issued. |
A "rollback" causes record contents to be restored to their value before modification (i.e. at the time BEGIN TRANSACTION was issued). This is particularly useful if an error occurs during a program that modifies files. | A "rollback" causes record contents to be restored to their value before modification (i.e. at the time BEGIN TRANSACTION was issued). This is particularly useful if an error occurs during a program that modifies files. | ||
− | If SET ROLLBACK is ON, | + | If SET ROLLBACK is ON, the ROLLBACK command will be executed automatically if an error occurs during the transaction process. Otherwise, error trapping should be handled manually using the ON ERROR command. |
The COMPLETED() function can be used after the END TRANSACTION command to determine if any errors occurred during processing of the commands between BEGIN and END TRANSACTION. | The COMPLETED() function can be used after the END TRANSACTION command to determine if any errors occurred during processing of the commands between BEGIN and END TRANSACTION. |
Revision as of 13:31, 19 December 2012
Contents
Purpose
Begin transaction Before Image Journaling
Syntax
BEGIN TRANSACTION [<path name>]
<commands>
END TRANSACTION
See Also
COMPLETED(), END TRANSACTION, ISMARKED(), RESET IN, ROLLBACK, ROLLBACK(), SET ROLLBACK
Description
The BEGIN TRANSACTION command is used to flag the beginning of a transaction for Before Image Journaling (BIJ). A 'transaction' consists of all file modifications that occur within the commands BEGIN TRANSACTION and END TRANSACTION.
When BEGIN TRANSACTION is issued all currently open files and all files opened between BEGIN and END TRANSACTION will have BIJ invoked automatically. If BIJ is not required on a particular table then the RESET IN command should be issued for the relevant workarea so that journaling will no longer occur in that workarea. The journals are stored in a log file (with a file extension of '.log') which is generated automatically. You can optionally specify the disk and directory <path name> where the log file will be stored when the BEGIN TRANSACTION command is issued.
A "rollback" causes record contents to be restored to their value before modification (i.e. at the time BEGIN TRANSACTION was issued). This is particularly useful if an error occurs during a program that modifies files.
If SET ROLLBACK is ON, the ROLLBACK command will be executed automatically if an error occurs during the transaction process. Otherwise, error trapping should be handled manually using the ON ERROR command.
The COMPLETED() function can be used after the END TRANSACTION command to determine if any errors occurred during processing of the commands between BEGIN and END TRANSACTION.
Please note that the following commands are not allowed during a transaction:
Example
procedure recovery rollback if rollback() dialog box "Rollback was ok." else dialog box "Rollback not completed." endif return use accounts on error do recovery begin transaction delete first 15 insert replace all t1 with (t2*t3)/100 list end transaction if completed() dialog box "Transaction completed" else dialog box "Errors occurred during transaction" endif