|
|
|
|
|
- Overview
- Comparing the two methods
The different types of browse available in SQL
Two types of browse can be used to browse the result of a query run by SQLExecThe 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 result | All 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 records | The number of records corresponding to the query result is automatically calculated when reading the first record (SQLFirst). The SQL.NbLine variable is updated | The number of records corresponding to the query result is not calculated. | SQLInfo | SQLInfo returns information about the query and the current browse. | SQLInfo returns general information about the query or the connection. | Browsing the records | Ability to go back to a previous result element | No 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 table | SQLTable must not be used (fatal error). | SQLTable can only be used to retrieve the result records from the current record. | Management of tabulations | This 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. For more details, see the help about SQLCol and SQLAssociate. | This type of browse can be used to retrieve the tabulations found in the values of records. For more details, see the help about SQLGetCol. | Example of SQLFirst/SQLCol browseResExec = SQLExec("SELECT CUSTNAME FROM INV","QRY1")
IF ResExec THEN
SQLFirst("QRY1")
WHILE NOT SQL.Out
ListAdd(LIST_NAMELIST, SQLCol("QRY1",1))
SQLNext("QRY1")
END
ELSE
END
SQLClose("QRY1")
Example of SQLFetch/SQLGetCol browse i is int = 0
SQLExec("SELECT LASTNAME, FIRSTNAME, EXTENSION, PHOTO FROM CUSTOMER", "QRY1")
WHILE SQLFetch("QRY1") = 0
i++
LASTNAME[i] = SQLGetCol("QRY1", 1)
FIRSTNAME[i] = SQLGetCol("QRY1", 2)
EXTENSION[i] = SQLGetCol("QRY1",3)
{"IMAGE"+i} = SQLGetMemo("QRY1", 4)
END
SQLClose("QRY1")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|