PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Overview
  • Comparing the two methods
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
The different types of browse available in SQL
Overview
Two types of browse can be used to browse the result of a query run by SQLExec
The following paragraphs present the benefits and the drawbacks of these two methods.
Comparing the two methods
The table below presents the characteristics of the two browsing methods:
SQLFirst/SQLCol browse
SQLFetch/SQLGetCol browse
Query resultAll the records found in the query result are loaded in memory when running SQLFirst.
The first call to SQLFirst can be quite long.
No record is loaded in memory. The query result is managed by the database.
Number of recordsThe number of records corresponding to the query result is automatically calculated when reading the first record (SQLFirst). The SQL.NbLine variable is updatedThe number of records corresponding to the query result is not calculated.
SQLInfoSQLInfo returns information about the query and the current browse.SQLInfo returns general information about the query or the connection.
Browsing the recordsAbility to go back to a previous result elementNo ability to go back to a previous result element
The query result is read by SQLCol, SQLAssociate.The query result is read by SQLGetCol and SQLGetMemo.
Display in a tableSQLTable must not be used (fatal error).SQLTable can only be used to retrieve the result records from the current record.
Management of tabulationsThis type of browse cannot be used to retrieve the tabulations found in the values of records. A tabulation separates two items. Only the part found before the tabulation will be retrieved by the read functions.
See the help about SQLCol and SQLAssociate for more details.
This type of browse can be used to retrieve the tabulations found in the values of records.
See the help about SQLGetCol for more details.


Example of SQLFirst/SQLCol browse
ResExec = SQLExec("SELECT CUSTNAME FROM INV","QRY1")
IF ResExec THEN
        SQLFirst("QRY1")
        // Transfer the name into LIST_NAMELIST
        WHILE NOT SQL.Out
                ListAdd(LIST_NAMELIST, SQLCol("QRY1",1))
                SQLNext("QRY1")
        END
ELSE
        // ProcessError
END
SQLClose("QRY1")
Example of SQLFetch/SQLGetCol browse
i is int = 0
SQLExec("SELECT LASTNAME, FIRSTNAME, EXTENSION, PHOTO FROM CUSTOMER", "QRY1")
// Retrieve the query line by line
WHILE SQLFetch("QRY1") = 0
        // There is still another line
        i++
        // Retrieve the data
        LASTNAME[i] = SQLGetCol("QRY1", 1)
        FIRSTNAME[i] = SQLGetCol("QRY1", 2)
        EXTENSION[i] = SQLGetCol("QRY1",3)
        {"IMAGE"+i} = SQLGetMemo("QRY1", 4)
END
SQLClose("QRY1")
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment