PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Location and access to data files
  • Detecting an error
  • Tip: Restoring the database consistency
  • Error cases
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
If a transaction is in progress, cancels all the operations performed on the data files in transaction since the start of transaction. In this case, the transaction is canceled without interrupting the program execution.
If no transaction is in progress, restores the consistency of the database and cancels the unsuccessful transaction (power failure for example).
Remark: A transaction that failed can be canceled by any program.
The transaction file is automatically destroyed if it is not shared. The records locked by the write operations performed during the transaction are unlocked.
AndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst The management of transactions is available for HFSQL Client/Server databases.
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.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
Java This function is now available for Java applications.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Java This function is now available for Java applications.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Java This function is now available for Java applications.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
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.
Example
MaConnexion est une Connexion
 
// Début de la transaction sur les fichiers de données associés à la connexion MaConnexion
MaConnexion.TransactionDébut()
Ajout_Commande()
QUAND EXCEPTION DANS
// Ajout de la commande
Commande.Ajoute()
// Validation de l'ajout
MaConnexion.TransactionFin()
FAIRE
// Suppression des lignes de commandes
MaConnexion.TransactionAnnule()
FIN
Syntax

Canceling a current transaction or an interrupted transaction on a Client/Server connection Hide the details

<Result> = <Connection>.TransactionCancel()
<Result>: Boolean
  • True if the transaction was canceled,
  • False if a problem occurred. The HErrorInfo function provides more information about the error.
Caution:
  • If a transaction is in progress on the connection, it is canceled.
  • If no transaction is in progress, the interrupted transactions are canceled for the specified connection.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.

Canceling an interrupted transaction on a Client/Server database (to be used if no transaction is in progress) Hide the details

<Result> = <Connection>.TransactionCancel(<Database>)
<Result>: Boolean
  • True if the transaction was canceled,
  • False if a problem occurred. HErrorInfo returns more details about the error.
Caution:
  • Only the interrupted transactions on the specified database are canceled.
  • The transactions in progress are not canceled.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.
<Database>: Character string
Name of relevant database. An error occurs if this parameter corresponds to an empty string ("").

Canceling a specific transaction, linked to a connection Hide the details

<Result> = <Connection>.TransactionCancel(<Transaction to cancel>)
<Result>: Boolean
  • True if the transaction was canceled,
  • False if a problem occurred. HErrorInfo returns more details about the error.
Caution: Only the interrupted transactions on the specified database are canceled.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.
<Transaction to cancel>: Integer
Identifier of transaction that will be canceled for the specified connection. This identifier is returned by <Connection variable>.TransactionList.
Remarks

Location and access to data files

Before calling <Connection variable>.TransactionCancel, the data files handled by the canceled transaction must be:

Detecting an error

When an error is detected by the program (management of errors with WHILE EXCEPTION for example), <Connection variable>.TransactionCancel is used to:

Tip: Restoring the database consistency

If a breakdown (power failure, reboot, ...) occurs during a transaction, the data files may become corrupted: the transaction was neither validated, nor canceled. The transaction file is still found on the computer.
To restore the consistency of the database, you should propose in your application:
Remark: this operation can be quite long (according to the number of operations performed in transaction).

Error cases

  • Nesting transactions: Transactions cannot be nested (that is, function <Connection variable>.TransactionStart or function <Connection variable>.Transaction cannot be called within 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".

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

OLE DB and Native Connectors

Only syntaxes with connection are taken into account by the Native Connectors that support transactions. You can also use SQLTransaction.
Component: wd270hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment