|
|
|
|
|
- Conditions for using HFreeQuery
HFreeQuery (Function) In french: HLibèreRequête Frees the resources of a query (after the call to HExecuteQuery or HExecuteSQLQuery). When to use HFreeQuery? This function can be used when no other process will be using the result coming from a query. We recommend that you use this function on the queries that return an important number of lines (tens of thousands) in order to free the memory space.
// Initializes the query IF HExecuteQuery(MyQuery) = False THEN Error("Error while initializing the query" + CR + HErrorInfo()) RETURN END Â // Read the first record of the query HReadFirst(MyQuery) WHILE NOT HOut() // Process on the query record ... // Read the next record HReadNext() END HFreeQuery(MyQuery) Syntax
<Result> = HFreeQuery([<Query>])
<Result>: Boolean - True if the operation was performed,
- False if a problem occurs. HError is used to identify the error.
<Query>: Optional character string Name of a query or a data source associated with a query (for freeing resources after the call to HExecuteQuery or HExecuteSQLQuery). If this parameter is not specified, corresponds to the last data file used. Remarks Conditions for using HFreeQuery This function must be used ONLY when the query is not required anymore! In the following example, HFreeQuery is used too soon: the table will be completely wrong. The Table control is populated using BuildBrowsingTable in a parallel process in the background. Therefore, HFreeQuery will operate before the Table control is entirely filled, making this control unusable.
HExecuteSQLQuery("test", "select * from customer") BuildBrowsingTable(TABLE_Table1, "test") HFreeQuery("test") Remark: The problem can also occur with a "data source" variable. A "data source" variable declared locally in a process (button click, procedure, method, etc.) ONLY exists during the execution of this code. For this reason, a "warning" is displayed when you are using this type of data source: "the data source will be destroyed at the end of this code".
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|