|
- Network application (ISAM database)
- Locking records
- Error cases
- Temporary files created during the transaction (ISAM database)
- Handling records during a transaction
- Transactions and independent HFSQL context
- OLE DB and Native Accesses
HTransactionStart (Function) In french: HTransactionDébut
Not available with this kind of connection
Starts a transaction on the data files (HFSQL or accessed via Native Access) and creates the file of transactions. 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. Versions 17 and later New in version 17 Versions 18 and later New in version 18Remark: From version 19, HFSQL is the new name of HyperFileSQL. Versions 21 and later New in version 21 Versions 23 and laterRemark: This function is equivalent to HTransaction. New in version 23Remark: This function is equivalent to HTransaction. Remark: This function is equivalent to HTransaction. Versions 19 and later
// Start the transaction on the 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
New in version 19
// Start the transaction on the 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 the transaction on the 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 the transaction on the Orders and OrdLine 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 Versions 19 and later
Starting a Client/Server transaction on a specific connection Hide the details
<Result> = HTransactionStart(<Connection name> [, <List of files>])
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<List of files>: Optional character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
New in version 19
Starting a Client/Server transaction on a specific connection Hide the details
<Result> = HTransactionStart(<Connection name> [, <List of files>])
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<List of files>: Optional character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
Starting a Client/Server transaction on a specific connection Hide the details
<Result> = HTransactionStart(<Connection name> [, <List of files>])
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<List of files>: Optional character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
Versions 19 and later
Starting a Client/Server transaction on a specific connection or an ISAM transaction Hide the details
<Result> = HTransactionStart(<Connection name> , <Name of transaction file> , <List of files>)
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- Empty string ("") or hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<Name of transaction file>: Character string (with quotes) <List of files>: Character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
New in version 19
Starting a Client/Server transaction on a specific connection or an ISAM transaction Hide the details
<Result> = HTransactionStart(<Connection name> , <Name of transaction file> , <List of files>)
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- Empty string ("") or hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<Name of transaction file>: Character string (with quotes) <List of files>: Character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
Starting a Client/Server transaction on a specific connection or an ISAM transaction Hide the details
<Result> = HTransactionStart(<Connection name> , <Name of transaction file> , <List of files>)
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Connection name>: Character string (with or without quotes) - Name of connection to use. This connection was defined:
- Empty string ("") or hAccessHF7 constant: The transaction is performed on the ISAM HFSQL files.
<Name of transaction file>: Character string (with quotes) <List of files>: Character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
Starting an ISAM and/or Client/Server transaction on all the HFSQL Client/Server connections (existing ones or future ones) Hide the details
<Result> = HTransactionStart([<Name of transaction file> [, <List of files>]])
<Result>: Boolean - True if the transaction was started,
- False if a problem occurred. HErrorInfo returns more details about the error.
<Name of transaction file>: Optional character string (with quotes) <List of files>: Optional character string (with quotes) List of logical names of one or more files to take into account (or not) in the transaction (in this case, the file name is preceded by the "-" sign). | | If this parameter is not specified | All the files used during the transaction will be taken into account in the transaction. | If all the files are prefixed by the "-" sign For example: "-Customer, -Product" | All the files specified in the list and used during the transaction will not be taken into account by the transaction. All the files not specified in the list will be taken into account and used during the transaction. | If no file in the list is prefixed by the "-" sign For example: "Customer, Product" | All the files specified in the list and used during the transaction will be taken into account by the transaction. All the files not specified in the list and used during the transaction will not be taken into account by the transaction. | If some files are prefixed by "-" and others are not For example: "-Customer, Product" (equivalent to "Product") | All the files in the list prefixed by "-" and used during the transaction will not be taken into account by the transaction. All the files in the list not prefixed by "-" and used during the transaction will be taken into account by the transaction. The files not specified in the list will be excluded from the transaction |
Remarks The added, modified or deleted records in a transaction are locked in write mode. - Nesting transactions: The transactions cannot be nested (HTransactionStart cannot be called in a transaction). In this case, the error 70031 occurs.
Versions 19 and laterA 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 19A 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 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.
This page is also available for…
|
|
|
| |
| | https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/3229-exemplo-leitura-xml-uma-nota-fiscal-3238/read.awp |
|
|
|
| |
| |
| |
|
| 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) |
|
|
|
| |
| |
| |
| |
| |
| |
| | |
| |