|
|
|
|
|
- Error cases
- Handling records during a transaction
- Transactions and independent HFSQL context
- OLE DB and Native Connectors
HTransactionEnd (Function) In french: HTransactionFin
Not available with this kind of connection
Validates the current transaction: - the modifications performed on the data file since the start of transaction (HTransactionStart or HTransaction) are validated.
- the transaction file is deleted (if this transaction is the last transaction in progress for a network application).
- the records locked in read-only by the transaction are unlocked.
MyConnection1 is Connection  // Start transaction on data files associated with MyConnection1 HTransactionStart(MyConnection1)  // Code used to prepare the order to added // ...  WHEN EXCEPTION IN // Add the order HAdd(Orders) // Validate the addition HTransactionEnd(MyConnection1) DO // Delete the order lines HTransactionCancel(MyConnection1) END
// Start transaction on the Orders and OrdLine data files HTransactionStart("C:\Temp\Transaction.trs", "Orders,OrdLine,-Customer") Â // Code used to prepare the order to added // ... Â WHEN EXCEPTION IN // Add the order HAdd(Orders) // Validate the addition HTransactionEnd() DO // Delete the order lines HTransactionCancel() END
Syntax
Validating a transaction in progress on a connection Hide the details
<Result> = HTransactionEnd(<Connection>)
<Result>: Boolean - True if the transaction is ended,
- False if a problem occurs. HErrorInfo returns more details about the error.
Caution: The function has no effect if a global transaction is started. The syntax 2 must be used.
<Connection>: Character string or Connection variable Connection to use. This connection corresponds to: If this parameter corresponds to the hAccessHF7 constant, the transaction will be performed on ISAM HFSQL files.
Validating a global transaction in progress Hide the details
<Result> = HTransactionEnd()
<Result>: Boolean - True if the transaction is ended,
- False if a problem occurs. HErrorInfo returns more details about the error.
Remarks Error cases - Nesting transactions: Transactions cannot be nested (i.e. HTransactionStart or HTransaction cannot be called in a transaction). In this case, error 70031 occurs.
- A fatal error is displayed in the following cases:
- A transaction is started on all the connections while there is at least one connection in transaction.
- A transaction is started on a connection while a transaction was already started on all the connections.
- A transaction is started on all the connections while there is at least one connection whose isolation mode is not "Read Uncommitted".
Handling records during a transaction Transactions and independent HFSQL context When copying a context, if a transaction is in progress on the first context, the new context is not in transaction. You must call HTransactionStart (or HTransaction) to start a transaction in the new context.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|