|
|
|
|
|
- Overview
- What is a transaction?
- Using the transactions according to your requirements
- Principle
- Principle of transactions on HFSQL data files
- Special cases
Transactions: Secure processes on HFSQL data files
Available only with these kinds of connection
This chapter presents the following topics: A transaction is a set of indissociable operations: either all the operations of the transaction are performed, or none is performed. The management of transactions is the best way to ensure the integrity of a set of indissociable write operations performed on HFSQL data files. For example, in a banking application, a transfer operation consists in debiting an account to credit another one. These two operations must be managed in a single transaction in order to avoid any incoherence (in case of power outage during the operation for example). Using the transactions according to your requirements Depending on your situation, let's see some tips for optimizing the management of transactions in your applications or sites: - Start transactions in applications installed on reliable computers (UPS, only one application running, etc.): disk transaction
In this case, the purpose of transactions is to be able to cancel a set of operations. It is possible to display windows in the middle of a transaction, to perform different lengthy processes, ... Each operation performed during the transaction is saved in a transaction file. The record used is locked in write mode until the transaction is validated or canceled. - Perform trusted write operations in the data files (banking sector, accounting, ...).
The transactions are used to insure the security of a set of operations. In this case, you must group all the write operations in your code in order to run them in a transaction. The code run during the transaction must display no window, must browse no data file, ... This code must only contain the operations for modifying the data files. Each operation performed during the transaction is saved in a transaction file. The record used is locked in write mode until the transaction is validated or canceled.
Principle of transactions on HFSQL data files Each write operation performed during a transaction is stored in a transaction file. The transaction can be canceled at any time: all operations performed since the beginning of transaction will be canceled. Once the write operations included in the transaction are completed, the program can validate the operations of the transaction. Remarks: - The transaction isolation level used is "READ UNCOMMITED".
- The transaction isolation level is defined with HTransactionIsolation. The default isolation level is the "READ UNCOMMITED" mode.
- Transactions are not available for Hyper File 5.5 data files.
Special cases - Error in the program, the transaction is automatically abandoned.
- Call to EndProgram, the transaction is automatically abandoned.
- Test canceled from the editor, the transaction is automatically abandoned.
- Power outage or unexpected stop of the application (application stopped by the task manager for example):
When the application is restarted, the consistency of the database can be restored:
Related Examples:
|
Training (WINDEV): WD Transaction
[ + ] This program, powered by WINDEV, is based on a simplified analysis (ORDERS, ORDERLINE and STOCK). It illustrates the operating mode of the transactions when placing an order.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|