PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 25 feature!
  • Locking records
  • Error cases
  • Handling records during a transaction
  • Transactions and independent HFSQL context
  • OLE DB and Native Connectors
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Starts a transaction on the data files (HFSQL or accessed via a Native Connector) and creates the transaction file.
What information is saved in the transaction file? Whenever a WLanguage function modifies a data file or an index file during a transaction, the former values of the record and the operation performed are stored in the transaction file.
HFSQL Client/Server
Versions 19 and later
The transaction can be started on a connection: In this case, a transaction is started only for files associated to this connection. This mode is required to manage the isolation levels of transactions.
New in version 19
The transaction can be started on a connection: In this case, a transaction is started only for files associated to this connection. This mode is required to manage the isolation levels of transactions.
The transaction can be started on a connection: In this case, a transaction is started only for files associated to this connection. This mode is required to manage the isolation levels of transactions.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
AndroidAndroid Widget iPhone/iPadWindows Mobile The management of transactions is available for the HFSQL Client/Server databases.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Java This function is now available for the Java applications.
Android This function is now available for Android applications.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Java This function is now available for the Java applications.
Android This function is now available for Android applications.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Java This function is now available for the Java applications.
Android This function is now available for Android applications.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 23 and later
Remark: This function is equivalent to <Connection variable>.Transaction.
New in version 23
Remark: This function is equivalent to <Connection variable>.Transaction.
Remark: This function is equivalent to <Connection variable>.Transaction.
Example
MyConnection1 is Connection
 
// Start transaction on data files associated with MyConnection1
MyConnection1.TransactionStart()
 
// Code used to prepare the order to added
// ...
 
WHEN EXCEPTION IN
// Add the order
Order.Add()
// Validate the addition
MyConnection1.TransactionEnd()
DO
// Delete the order lines
MyConnection1.TransactionCancel()
END
Syntax

Starting a Client/Server transaction on a specific connection Hide the details

<Result> = <Connection>.TransactionStart([<List of data files>])
<Result>: Boolean
  • True if the transaction was started,
  • False if a problem occurred. HErrorInfo returns more details about the error.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.
<List of data files>: Optional character string (with quotes)
List of logical names of one or more data files to take into account (or not) in the transaction (in this case, the data file name is preceded by the "-" sign).
If this parameter is not specifiedAll data files used during the transaction will be taken into account in the transaction.
If all data files are prefixed with the "-" sign
For example: "-Customer, -Product"
All data files specified in the list and used during the transaction will not be taken into account by the transaction.
All data files not specified in the list will be taken into account and used during the transaction.
If no data file on the list is prefixed with the "-" sign
For example: "Customer, Product"
All data files specified in the list and used during the transaction will be taken into account in the transaction.
All data files not specified and manipulated during the transaction will be ignored in the transaction.
If some data files are prefixed with "-" and others are not
For example: "-Customer, Product" (equivalent to "Product")
All data files in the list prefixed with "-" and used during the transaction will be ignored in the transaction.
All data files in the list not prefixed with "-" and used during the transaction will be taken into account in the transaction.
The files not specified in the list will be excluded from the transaction.
OLE DBNative Connectors (Native Accesses) This parameter is ignored. All the data files associated with the connection are in transaction on the native server.

Starting a Client/Server transaction on a specific connection Hide the details

<Result> = <Connection>.TransactionStart(<Transaction file> , <List of data files>)
<Result>: Boolean
  • True if the transaction was started,
  • False if a problem occurred. HErrorInfo returns more details about the error.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.
<Transaction file>: Character string (with quotes)
Full name of transaction file (used to store the operations performed in transaction).
This parameter is not taken into account for connections to an HFSQL Server.
<List of data files>: Character string (with quotes)
List of logical names of one or more data files to take into account (or not) in the transaction (in this case, the data file name is preceded by the "-" sign).
If this parameter is not specifiedAll data files used during the transaction will be taken into account in the transaction.
If all data files are prefixed with the "-" sign
For example: "-Customer, -Product"
All data files specified in the list and used during the transaction will not be taken into account by the transaction.
All data files not specified in the list will be taken into account and used during the transaction.
If no data file on the list is prefixed with the "-" sign
For example: "Customer, Product"
All data files specified in the list and used during the transaction will be taken into account in the transaction.
All data files not specified and manipulated during the transaction will be ignored in the transaction.
If some data files are prefixed with "-" and others are not
For example: "-Customer, Product" (equivalent to "Product")
All data files in the list prefixed with "-" and used during the transaction will be ignored in the transaction.
All data files in the list not prefixed with "-" and used during the transaction will be taken into account in the transaction.
Data files not specified in the list will be excluded from the transaction.
OLE DBNative Connectors (Native Accesses) This parameter is ignored. All the data files associated with the connection are in transaction on the native server.
Remarks

Locking records

The added, modified or deleted records in a transaction are locked in write mode.

Error cases

  • Nesting transactions: Transactions cannot be nested (i.e. <Connection variable>.TransactionStart cannot be called in a transaction). In this case, error 70031 occurs.
  • Versions 19 and later
    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".
    New in version 19
    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".
    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

During a transaction, some rules must be complied with when handling the records. See Transactions: Handling records during a transaction for more details.

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 <Connection variable>.TransactionStart to start a transaction in the new context.
WINDEVWEBDEV - Server codeAjaxUser code (UMC)OLE DBNative Connectors (Native Accesses)

OLE DB and Native Connectors

<Connection variable>.TransactionStart cannot be used in this version. To start a transaction, use SQLTransaction.Only the syntaxes with connection are taken into account by the Native Accesses that support the transactions. You can also use SQLTransaction.
Component : wd250hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment