COMMIT

How to:

Reference:

The COMMIT command processes a logical transaction. A logical transaction is a group of data source operations in an application that are treated as one. The COMMIT operation signals a successful end of a transaction and writes the INCLUDE, UPDATE, and DELETE operations to the data source. The data source is, or should be, in a consistent state and all of the updates made by that transaction are now made permanent.

Syntax: How to Use the COMMIT Command

The syntax of the COMMIT command is

COMMIT [;]

where:

;

Terminates the command. Although the semicolon is optional, it is recommended that you include it to allow for flexible syntax and better processing. For more information about the benefits of including the semicolon, see Language Rules Reference.

Reference: Usage Notes for COMMIT

  • When you issue a transaction that writes to multiple types of data sources, each DBMS evaluates its part of the transaction independently. When a COMMIT command ends the transaction, the success of the COMMIT against each data source type is independent of the success of the COMMIT against the other data source types.

    For example, if you run a procedure that accesses the App Studio data sources Employee and JobFile and the SQL Server data source Salary, the success or failure of the COMMIT for Salary is independent of the success of the COMMIT for Employee and JobFile. This is known as a broadcast commit.

  • COMMIT is automatically issued when a procedure does not contain any COMMIT commands, and the application is exited normally. This means an error did not cause program termination. If a procedure does not contain any COMMIT commands and it is terminates abnormally (for example, if the system has run out of memory), a COMMIT is not issued. When a called procedure is exited, an automatic COMMIT is not issued. COMMIT is only issued when exiting the application.
  • The variable FocCurrent is set after a COMMIT finishes. If the COMMIT is successful, FocCurrent is set to zero (0). If FocCurrent is non-zero, the COMMIT failed, and all of the records in the logical unit of work will be rolled back because an internal ROLLBACK will be issued.