PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
This content comes from an automatic translation.
  • 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
Validates the current transaction:
  • the modifications performed on the data file since the start of transaction (HTransactionStart) are validated.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.
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 the Java applications.
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 the Java applications.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Java This function is now available for the Java 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.
Example
WINDEVUser code (UMC)HFSQL
// Start the transaction on the Orders and OrdLine files
HTransactionStart("C:\Temp\Transaction.trs", "Orders,OrdLine,-Customer")
Add_Order()
WHEN EXCEPTION IN
// Add the order
HAdd(Orders)
// Validate the addition
HTransactionEnd()
DO
// Delete the order lines
HTransactionCancel()
END
Syntax
Versions 19 and later
Java This syntax is not available in Android, Android Widget and Java.

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 occurred. HErrorInfo returns the error details.
Caution: The function has no effect if a global transaction is started. The syntax 2 must be used.
<Connection>: Character string (with or without quotes) or Connection variable
Connection to handle. This connection corresponds to: If this parameter corresponds to the constant hAccessHF7, the transaction is performed on the HFSQL ISAM data files.
New in version 19
Java This syntax is not available in Android, Android Widget and Java.

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 occurred. HErrorInfo returns the error details.
Caution: The function has no effect if a global transaction is started. The syntax 2 must be used.
<Connection>: Character string (with or without quotes) or Connection variable
Connection to handle. This connection corresponds to: If this parameter corresponds to the constant hAccessHF7, the transaction is performed on the HFSQL ISAM data files.
Java This syntax is not available in Android, Android Widget and Java.

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 occurred. HErrorInfo returns the error details.
Caution: The function has no effect if a global transaction is started. The syntax 2 must be used.
<Connection>: Character string (with or without quotes) or Connection variable
Connection to handle. This connection corresponds to: If this parameter corresponds to the constant hAccessHF7, the transaction is performed on the HFSQL ISAM data files.

Validating a global transaction in progress Hide the details

<Result> = HTransactionEnd()
<Result>: Boolean
  • True if the transaction is ended,
  • False if a problem occurred. The HErrorInfo function provides more information on the error.
Remarks

Error cases

  • Nesting transactions: It is not possible to nest transactions (i.e. call function HTransactionStart in a transaction). In this case, the error 70031 occurs.Nesting transactions: It is not possible to nest transactions (that is, to call function HTransactionStart or function HTransaction in a transaction). In this case, the 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 HTransactionStart to start a transaction in the new 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.
WINDEVOLE DBNative Connectors (Native Accesses)

OLE DB and Native Connectors

HTransactionEnd cannot be used in this version. To start a transaction, use SQLTransaction.Only syntaxes with connection are taken into account by the Native Connectors s (also called Native Access) that manage transactions. You also have the ability to use SQLTransaction.
Component : wd250hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Example in doc correcton
When using Transaction commands Start, End and Cancel always include the connection or source used in the Start in the associated End and Cancel

TransactionStart(MyConnection)

Hadd(Customer)
if ErrorOccurred() then
TransactionCancel(MyConnection)
ELSE
TransactionEnd(MyConnection)
END
CCordes
03 Oct. 2019
Example Transaction with commit 100 in 100
//SQL

SERIAL is int

HTransactionStart(Hfsql)

FOR EACH t0010_enderecoscorreios //leitura da tabela ms sql server // TABELA DE ORIGEM

SERIAL += 1

PROGBAR_01..Value += 1
IF PROGBAR_01..Value = 100 THEN
HTransactionEnd(Hfsql) //commit
PROGBAR_01..Value = 0
HTransactionStart(Hfsql) //start
Multitask(1) //permite compartilhar o processador com os outros prog e serviços windows
END

//HFSQL = MS SQL SERVER 2016 / DEVELOPER
enderecoscorreios.LogradouroAbrev = t0010_enderecoscorreios.LogradouroAbrev
enderecoscorreios.Logradouro = t0010_enderecoscorreios.Logradouro

ok is boolean = HAdd(enderecoscorreios) // gravacao no hfsql
IF ok = False THEN
HTransactionCancel(Hfsql) //Rollback
END

END

Info(SERIAL)
BOLLER
13 Apr. 2017