PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Conditions for using <Source>.FreeQuery
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
<Source>.FreeQuery (Function)
In french: <Source>.LibèreRequête
Frees the resources of a query (after the call to 0 or 0).
Remark: This function is based on <Source>.CancelDeclaration.
When to use <Source>.FreeQuery?
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.
Versions 17 and later
Java This function is now available for Java applications.
New in version 17
Java This function is now available for Java applications.
Java This function is now available for Java applications.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Example
// Initializes the query
IF MyQuery.ExecuteQuery() = False THEN
Error("Error while initializing the query" + CR + HErrorInfo())
RETURN
END
 
// Read the first record of the query
MyQuery.ReadFirst()
WHILE NOT MyQuery.Out()
// Process on the query record
...
// Read the next record
MyQuery.ReadNext()
END
MyQuery.FreeQuery()
Syntax
<Result> = <Source>.FreeQuery()
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HError is used to identify the error.
<Source>: Type corresponding to the specified source
Name of a query or a data source associated with a query (for freeing resources after the call to 0 or 0).
Remarks

Conditions for using <Source>.FreeQuery

This function must be used ONLY when the query is not required anymore!
In the following example, <Source>.FreeQuery is used too soon: the table will be completely wrong. Indeed, BuildBrowsingTable (used to fill the Table control) is run in background task in a parallel process. Therefore, <Source>.FreeQuery will operate before the Table control is entirely filled, making this control unusable.
Test.ExecuteSQLQuery("select * from customer")
BuildBrowsingTable(TABLE_Table1, "test")
Test.FreeQuery()

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".
Component: wd260hf.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment