PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Syntax 2: Performing a transaction on a connection
  • Nesting transactions
  • Native MySQL Access
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
SQLTransaction (Function)
In French: SQLTransaction
Allows you to start, validate or cancel a transaction:
  • on the files of a database opened by SQLConnect,
  • on the files of a database opened by a connection (OLE DB or Native Access) described in the data model editor or by HOpenConnection.
Note: This function is the only SQL function that can be used with the HFSQL functions (to perform transactions on an external database handled by the HFSQL functions for example).
Java This function can only be used to manage the transactions on the SQLxxx functions.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Note: 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.
WINDEVWEBDEV - Server codeReports and QueriesJavaAjaxUser code (UMC)OLE DB
ConnectionNum is int = SQLConnect("MyDatabase", "User", "Password", "", ...
"OLEDB", "MyProvider")
IF ConnectionNum = 0 THEN
SQLInfo()
Error("Error while opening the connection: " + SQL.MesError)
ELSE
// Put the connection in transaction
SQLTransaction(sqlStart)
// Modify the value of all the AFile.AnItem items
IF SQLExec("UPDATE AFile SET AnItem = 'new value", ...
"UpdateQuery") = True THEN
// Ends the transaction
SQLTransaction(sqlCommit)
ELSE
SQLInfo("UpdateQuery")
Error("Error while running the query: " + SQL.MesError)
// Cancel the transaction
SQLTransaction(sqlRollBack)
// The content of AFile did not change
END
END
Syntax

Transaction on the files of a database opened by SQLConnect Hide the details

<Result> = SQLTransaction(<Indicator>)
<Result>: Boolean
  • True if the operation was performed,
  • False otherwise.
<Indicator>: Integer constant
Type of transaction operation to perform:
sqlStartStarts the transaction.
sqlCommitEnds the transaction.
sqlRollBackCancels the transaction.
Note: This syntax is not available in Android.
WINDEVWEBDEV - Server codeWINDEV MobileReports and QueriesAndroidAndroid Widget AjaxUser code (UMC)

Transaction on the files of a database opened by a connection described in the analysis or by HOpenConnection Hide the details

<Result> = SQLTransaction(<Indicator> , <Connection>)
<Result>: Boolean
  • True if the operation was performed,
  • False otherwise.
<Indicator>: Integer constant
Type of transaction operation to perform:
sqlStartStarts the transaction.
sqlCommitEnds the transaction.
sqlRollBackCancels the transaction.
<Connection>: Character string (with or without quotes)
Name of connection used to access the database. This name was defined in the data model editor or by HOpenConnection. This connection must have been described during the call to SQLTransaction. If the connection is not opened during the call to SQLTransaction, the specified connection is automatically opened.
Remarks

Syntax 2: Performing a transaction on a connection

To perform a transaction on a connection, you must:
  1. Start the connection (SQLTransaction(sqlStart)).
  2. Perform the operations on the data files with the relevant HFSQL functions.
  3. End the transaction:
    • by validating the operations performed (SQLTransaction(sqlCommit)).
    • by canceling the operations performed (SQLTransaction(sqlRollBack)).

Nesting transactions

The transactions can be nested.
Java The transactions cannot be nested. A WLanguage error occurs if a transaction is started while another transaction is in progress.
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC)Native Accesses

Native MySQL Access

SQLLock and SQLTransaction are used to manage the locks and transactions on the MySQL "innoDB" tables.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment