|
|
|
|
|
- Why should the hQueryWithoutCorrection constant be used
- Passing parameters to the query
HExecuteQueryAsynchronous (Function) In french: HExécuteRequêteAsynchrone Executes a SELECT query asynchronously. This query can correspond to: - a query created in the query editor.
- an SQL Query variable.
Use conditions: - This mode is intended for queries whose execution takes a few seconds. For immediate or almost immediate queries, this mode is too slow.
- The query must be of type "SELECT": it must return records.
- A query can only be executed asynchronously from the main context. In other cases, it is necessary to use threads.
- This function does not allow passing parameters to a query that already has a parameter. Parameters must be passed before the query is executed.
HExecuteQueryAsynchronous(REQ_MaRequete, hQueryDefault, MaProcedurePourChaqueEnregistrement, MaProcedureFinale)  INTERNAL PROCÉDURE MaProcedurePourChaqueEnregistrement(enreg is Record of REQ_MaRequete) Trace("Procédure de traitement de chaque enregistrement " + enreg.NomRubrique) END  INTERNAL PROCÉDURE MaProcedureFinale(MonRes is int) Trace("Procédure de traitement du résultat final") SWITCH MonRes CASE heqaOK: Trace("La requête et le traitement des enregistrements se sont bien exécutés.") CASE heqaCanceled: Trace("Un traitement a renvoyé Faux. La requête et les procédures ont été annulées.") OTHER CASE: Trace("Une procédure ou l'exécution de la requête a rencontré une erreur.") END END Syntax
Executing a query (without connection) Hide the details
<Result> = HExecuteQueryAsynchronous(<Query name> [, <Mode>] , <WLanguage procedure for each record> [, <End WLanguage procedure>])
<Result>: boolean - True if the query was initialized (the SQL code of the query is valid),
- False otherwise. HError returns more details about the problem.
<Query name>: Character string Name of query to be executed: - Name and full path of query (".WDR" file) to initialize.
Not available. - Logical name of the query to be initialized.
If a query with the same name is already declared, it is replaced by the new query. - Name of a variable of type SQL query.
<Mode>: Optional Integer constant Option for initializing the query: | | hQueryDefault (default value) | Initialize the query. | hQueryWithoutCorrection | | hQueryWithoutHFCorrection | |
<WLanguage procedure for each record>: Procedure name WLanguage procedure ("callback") executed for each record found corresponding to the query. This procedure has the following format:
PROCEDURE <Nom de la procédure>(UnEnreg est un Enregistrement) where <ARec> is a Record variable that corresponds to the current record (for the executed query). By default, the procedure returns True and goes to the next record. If this procedure returns False, the query is canceled and the <End WLanguage procedure> is executed. <End WLanguage procedure>: Optional procedure name WLanguage procedure ("callback") executed at the end of the execution of the query. This procedure has the following format:
PROCEDURE <Nom de la procédure>(nRésultat est un entier) where <nResult> is an Integer constant that can correspond to the following values: | | heqaCanceled | The procedure executed for each record returned False. The query and the different procedures were canceled. | heqaError | The query and/or the procedure called for each record encountered an error. You can get more details on the error with HErrorInfo. | heqaOK | The query and the procedure were correctly executed for each record. | Remark: The query is destroyed once all records have been read. The <End WLanguage procedure> can only be used to know how the iteration ended.
Executing a query via a connection Hide the details
<Result> = HExecuteQueryAsynchronous(<Query name> [, <Connection> [, <Mode>]] , <WLanguage procedure for each record> [, <End WLanguage procedure>])
<Result>: boolean - True if the query was initialized (the SQL code of the query is valid),
- False otherwise. HError returns more details about the problem.
<Query name>: Character string Name of query to be executed: - Name and full path of query (".WDR" file) to initialize.
Not available. - Logical name of the query to be initialized.
If a query with the same name is already declared, it is replaced by the new query. - Name of a variable of type SQL query.
<Connection>: Optional character string Name of the connection, defined in the data model editor or dynamically with HDescribeConnection. The query will be executed via this connection.
<Mode>: Optional Integer constant Option for initializing the query: | | hQueryDefault (default value) | Initialize the query. | hQueryWithoutCorrection | | hQueryWithoutHFCorrection | |
<WLanguage procedure for each record>: Procedure name WLanguage procedure ("callback") executed for each record found corresponding to the query. This procedure has the following format:
PROCEDURE <Nom de la procédure>(UnEnreg est un Enregistrement) where <ARec> is a Record variable that corresponds to the current record (for the executed query). By default, the procedure returns True and goes to the next record. If this procedure returns False, the query is canceled and the <End WLanguage procedure> is executed. <End WLanguage procedure>: Optional procedure name WLanguage procedure ("callback") executed at the end of the execution of the query. This procedure has the following format:
PROCEDURE <Nom de la procédure>(nRésultat est un entier) where <nResult> is an Integer constant that can correspond to the following values: | | heqaCanceled | The procedure executed for each record returned False. The query and the different procedures were canceled. | heqaError | The query and/or the procedure called for each record encountered an error. You can get more details on the error with HErrorInfo. | heqaOK | The query and the procedure were correctly executed for each record. | Remark: The query is destroyed once all records have been read. The <End WLanguage procedure> can only be used to know how the iteration ended. Passing parameters to the query To pass parameters to a query before executing it, the following syntax must also be used: <Nom de la requête>.<Nom du paramètre 1> = xxx <Nom de la requête>.<Nom du paramètre 2> = xxx <Nom de la requête>.<Nom du paramètre 3> = xxx HExécuteRequêteAsynchrone(<Nom de la requête>, <Procédure>) SI ErreurDétectée = Vrai ALORS ... Remark: The structure of the query parameters is reset each time the query is executed. Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|