ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / SQL functions
  • SQLFetch/SQLFetch: Partial retrieval of query results
  • Life cycle of a browse
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Goes to the next row (i.e next record) of the query result.
When SQLFetch is called for the first time, the current record will be the first record selected by the query.
This function is used to browse the query result "line by line". For more details on the different modes to loop through a query result, see Types of SQL browse.
Java To optimize performance, we recommend that you use a SQLFirst/SQLNext browse.
Example
WINDEVJavaUser code (UMC)HFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)
i is int = 0
SQLExec("SELECT NOM, PRENOM, POSTE, PHOTO FROM CLIENT", "REQ1")
// Récupérer la requête ligne à ligne
WHILE SQLFetch("REQ1") = 0
	// Il y a encore une ligne à lire
	i++
	// Récupérer les données
	NOM[i] = SQLGetCol("REQ1", 1)
	PRENOM[i] = SQLGetCol("REQ1", 2)
	POSTE[i] = SQLGetCol("REQ1", 3)
	{"IMAGE"+i} = SQLGetMemo("REQ1", 4)
END
SQLClose("REQ1")
Syntax
<Result> = SQLFetch(<Query name>)
<Result>: Integer
0 if the record was successfully read. The data can be retrieved by SQLGetCol and SQLGetMemo.
<Query name>: Character string
Java The queries created with the query editor must be specified in the format of a character string.
Remarks

SQLFetch/SQLFetch: Partial retrieval of query results

The function SQLFetch FUNCTION function does not retrieve all rows in the query result: only the current record is retrieved by the SQLFetch FUNCTION..
Therefore, the total number of result rows (SQL.NbLine) cannot be retrieved by SQLInfo if SQLFetch is used to browse the result.
Linux

Life cycle of a browse

The time it takes SQLFetch to retrieve data from the result is limited to the execution time of the PHP script. SQLFetch cannot continue to retrieve data after the page is returned (even in Session mode).
Component: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help