ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / SQL functions
  • Characteristics of the Table control populated programmatically
  • Closing a query
  • Using the Partial Fetch
  • The different types of queries
  • Retrieving Float items on Oracle (via ODBC)
  • Unicode management
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Transfers the result of a query to a Table control populated programmatically (a List Box or Combo Box control), with the possibility of Partial Fetch (the result is retrieved by blocks of rows). In a "SQLFetch/SQLGetCol" browse, the transfer of information to the Table control will start from the current record.
Remark: This function must be used to browse the result of the SQLFetch/SQLGetCol query. A fatal error occurs if this function is used in an SQLFirst/SQLCol browse. For more details, see Types of SQL browse.
Java The partial fetch is automatically performed by the Java framework.
PHP SQLTable does not operate if the query contains binary memos. The binary memos must be processed separately (they must be saved by fSaveText for example).
Example
// Transfer to a Table control: retrieval without fetch
ResSQL = SQLExec("SELECT CUSTNAME, CUSTFIRSTNAME FROM INV", "QRY1")
IF ResSQL THEN
SQLTable("QRY1", TABLE_QryTab, "Customer name" + TAB + "First name", "30 20")
// Calculates the number of result records
NbRec is int = TableCount(TABLE_QryTab)
ELSE
// SQL error
END
SQLClose("QRY1")
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)PHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)
// Transfer to a Table control: retrieve the first 25 ones
ResSQL = SQLExec("SELECT CUSTLASTNAME, CUSTFIRSTNAME, CITY FROM INV", "QRY1")
IF ResSQL THEN
// Get the first 25 rows only
SQLTable("QRY1", TABLE_QryTab, 25)
ELSE
// SQL error
END
SQLClose("QRY1")
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)
// Transfer to a Table control: retrieval by fetch
ResSQL = SQLExec("SELECT CUSTLASTNAME, CUSTFIRSTNAME, CITY FROM INV", "QRY1")
IF ResSQL THEN
// Retrieve by groups of 28 rows
WHILE SQLTable(28, "QRY1", TABLE_MYTABLE, "TitleCol", "90")
// Process  
ELSE
// SQL error
END
SQLClose("QRY1")
Syntax

Transfer to a Table control populated programmatically without Partial Fetch Hide the details

SQLTable(<Query name> , <Table control> , <Maximum number of rows> [, <Title of columns>] , <Width of columns>)
<Query name>: Character string
Name of the query created and executed with SQLExecWDR, or executed with SQLExec.
Java The query name must necessarily be enclosed in quotes.
<Table control>: Control name
Name of the Table control populated programmatically where the result of the query will be displayed.
<Maximum number of rows>: Integer
Maximum number of rows displayed in the Table control. If this parameter is specified, the Table control will contain a maximum of <Maximum number of rows> rows displayed, even if the result of the query contains a greater number of rows.
<Title of columns>: Optional character string
List of all the column titles in the Table control populated programmatically. The different titles are separated by TAB characters. To specify the widths of the columns only, this parameter can correspond to an empty string ("").
<Width of columns>: Character string
List of all the column widths, separated by a space character. To specify the titles of the columns only, this parameter can correspond to an empty string ("").
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax

Transfer to a Table control populated programmatically with Partial Fetch Hide the details

SQLTable(<Number of rows in a block> , <Query name> , <Table control> [, <Title of columns>] , <Width of columns>)
<Number of rows in a block>: Integer
Number of rows included in a block for the Partial Fetch. Only this block of rows is loaded in memory, the following blocks are automatically loaded in memory in a background task.
<Query name>: Character string
Name of the query created and executed with SQLExec, or executed with SQLExecWDR.
<Table control>: Control name
Name of the Table control populated programmatically where the result of the query will be displayed.
<Title of columns>: Optional character string
List of all the column titles in the Table control populated programmatically. The different titles are separated by TAB characters. To specify the widths of the columns only, this parameter can correspond to an empty string ("").
<Width of columns>: Character string
List of all the column widths, separated by a space character. To specify the titles of the columns only, this parameter can correspond to an empty string ("").
Remarks

Characteristics of the Table control populated programmatically

The number of columns in the Table control populated programmatically must be sufficient to accept all the columns of the query result.

Closing a query

A query is automatically closed:
  • once SQLTable has been executed if the partial Fetch is not used.
  • as soon as the query result is entirely retrieved if the Partial Fetch is used.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)PHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)

Using the Partial Fetch

The current retrieval stops as soon as SQLClose is called or as soon as the window containing the Table control is closed.
The Partial Fetch can be used on several queries at the same time.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)PHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)

The different types of queries

SQLTable associates a Table control populated programmatically with the queries created by SQLExec.
To associate a Table control populated programmatically with the queries created in the query editor (or with HExecuteSQLQuery), use FileToMemoryTable.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxODBC

Retrieving Float items on Oracle (via ODBC)

By default, the decimal separator used for the Float items on Oracle is the dot. However, the ODBC driver returns the value by using the comma as decimal separator. The decimal places are lost when the value is assigned to a numeric control.
To avoid this problem, you must configure the decimal separator for the current connection:
// Connection to the Oracle database
SQLConnect("MyOracleDatabase", "User", "Pass", "", "ODBC")
// Request for changing the decimal separator
SQLExec("ALTER SESSION SET NLS_NUMERIC_CHARACTERS ='. '", "TempQry")

Unicode management

You can define how Unicode will be managed in the project configuration ("Unicode" tab of the configuration description window):
  • If the "Use ANSI strings at runtime" option is selected: the data is converted using the current character set.
    Reminder: ChangeCharset changes the current character set.
  • If "Use UNICODE strings at runtime" is selected, the data is inserted without being converted.
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help