- Principle of transactions on HFSQL Client/Server files and on HFSQL Classic files
- Advanced management
- Files created by a transaction
- Organization of files on the server
- Identifier of the computer that performs the transaction
- Errors specific to the management of transactions in HFSQL Client/Server mode
Transactions in HFSQL Client/Server mode
Available only with this kind of connection
To keep maximum compatibility between HFSQL Classic applications (single-user or multi-user) and HFSQL Client/Server applications, the transaction mechanism in HFSQL Client/Server mode is similar to the one in HFSQL Classic mode.
This help page presents the differences between the operating modes.
Principle of transactions on HFSQL Client/Server files and on HFSQL Classic 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.
The transaction is automatically canceled:
- when a fatal error occurs in the program (the application is closed).
- during the call to EndProgram.
- when the test mode is stopped from the editor.
- when a power failure occurs or when the application is shut down unexpectedly.
- when the connection is lost or closed by the client.
- when the server is restarted. Caution: the transaction is not canceled if a secured password is assigned to the file involved in the transaction. The transaction will be canceled during the next opening of the data file.
Isolation of transactions
The HFSQL engine proposes to isolate the transactions: the modifications performed in a transaction in progress are isolated from the ones performed in the other transactions run simultaneously, until it is committed.
Several isolation modes are available:
- "READ UNCOMMITTED": Read uncommitted data (default mode).
- "READ COMMITTED": Read committed data.
- "REPEATABLE READ": Snapshot transactions
Files created by a transaction
Several types of HFSQL data files are created when the transactions are implemented:
- the log of operations in transaction: File in HFSQL format containing the different operations performed on the application files taken into account by the transaction. This file is created with HTransactionStart (or HTransaction). It is named TRSOPERATION.TRS.
- the identification log: File containing information used to identify the transaction (name of the client, computer, ...). This file is named TRSOperationInfoClient.TRS.
- the log of values: File associated with each data file taken into account by the transaction. This file is named <FileName>.TRX. For each operation performed in the transaction, this file contains:
- the content of the record after the operation (during a deletion for example).
- the content of the record after the operation (during an addition for example).
Organization of files on the server
|1. __TRS directory|
This directory contains:
For example, if the Orders file of DataApplicationA is in transaction, the __TRS\DataApplicationA subdirectory will contain the Orders.TRX file.
- The log of operations in transaction.
- The identification log
- For each data file in transaction of each database, the corresponding file of values. The tree structure used corresponds to the tree structure of the data files associated with the database.
Another example: if the Customer file of DataApplicationB is in transaction, the __TRS\DataApplicationB\Customer subdirectory will contain the Customer.TRX file.
2. Database directory DataApplicationA
3. Database directory DataApplicationB
Identifier of the computer that performs the transaction
The computer that performs the transaction is identified according the same method in HFSQL Classic and in HFSQL Client/Server: By default, the computer is identified by a unique number and by the computer name (defined in Windows).
To easily identify the computer that performs the operations in transaction, HComputer
allows you to define an identifier specific to the computer. This identifier replaces the computer name. This identifier is saved in the log of operations in transaction and it can be consulted via the HFSQL Control Center.
The client is identified by:
- HComputer (identical to HFSQL Classic).
- Name and IP address of computer.
- Name of the application, that is ExecutableName (ProjectName).
Errors specific to the management of transactions in HFSQL Client/Server mode
74020: The password of the transaction file does not correspond to the password of the source file
The data file (in HFSQL Client/Server mode) and the transaction file do not use the same password.
70032: Problem of isolation mode
This error can occur in the following cases:
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…