4D v16Transactions |
||
|
4D v16
Transactions
Transactions
Transactions are a set of SQL statements that are executed together. Either all of them are successful or they have no effect. Transactions use locks to preserve data integrity during their execution. If the transaction finishes successfully, you can use the COMMIT statement to permanently store its modifications. Otherwise, using the ROLLBACK statement will cancel any modifications and restore the database to its previous state. There is no difference between a 4D transaction and an SQL transaction. Both types share the same data and process. SQL statements passed between Begin SQL/End SQL tags, the QUERY BY SQL and the integrated generic SQL commands applied to the local database are always executed in the same context as standard 4D commands. Note: 4D provides an "Auto-commit" option which can be used to start and validate transactions automatically when using SIUD commands (SELECT, , UPDATE and DELETE) in order to preserve data integrity. For more information, please refer to the Principles for integrating 4D and the 4D SQL engine section. The following examples illustrate the different combinations of transactions. Neither “John” nor “Smith” will be added to the emp table: SQL LOGIN(SQL_INTERNAL;"";"") `Initializes the 4D SQL engine Only “John” will be added to the emp table: SQL LOGIN(SQL_INTERNAL;"";"") Neither “John” nor “Smith” will be added to the emp table. The exter-nal transaction cancels the internal transaction: SQL LOGIN(SQL_INTERNAL;"";"") “John” and “Smith” will be added to the emp table: SQL LOGIN(SQL_INTERNAL;"";"")
|
PROPERTIES
Product: 4D
HISTORY
ARTICLE USAGE
4D SQL Reference ( 4D v16) |