ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Conditions for using HFreeQuery
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Frees the resources of a query (after the call to HExecuteQuery or HExecuteSQLQuery).
Note: This function is based on the HCancelDeclaration function..
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.
Example
// Initialise la requête
IF HExecuteQuery(MaRequête) = False THEN
	Error("Erreur d'initialisation de la requête" + CR + HErrorInfo())
	RETURN
END

// Lecture du premier enregistrement de la requête
HReadFirst(MaRequête)
WHILE NOT HOut()
	// Traitement sur l'enregistrement de la requête
	...
	// Lecture de l'enregistrement suivant
	HReadNext()
END
HFreeQuery(MaRequête)
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, function HFreeQuery is used too early: the table will be completely distorted. 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 client")
BuildBrowsingTable(TABLE_Table1, "test")
HFreeQuery("test")

Note The problem can also occur with a variable of type "data source". 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 if you use this type of data source: "the data source will be destroyed at the end of this code".
Component: wd300hf.dll
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help