PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Current line in the query
  • Query columns
  • Query without result
  • Using tabulations in the items
  • SQLCol and SQLGetCol functions
  • Retrieving Float items on Oracle (via ODBC)
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
Retrieves the content of the specified column from the query result, for the current line.
Caution: This function must be used during a "SQLFetch/SQLGetCol" browse of the query result. For more details, see Types of SQL browse.
Versions 16 and later
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). Only the SQLFetch/SQLGetCol browse mode is available. For more details, see Accessing a database in local mode (SQLite).
New in version 16
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). Only the SQLFetch/SQLGetCol browse mode is available. For more details, see Accessing a database in local mode (SQLite).
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). Only the SQLFetch/SQLGetCol browse mode is available. For more details, see Accessing a database in local mode (SQLite).
Versions 19 and later
Android Widget This function is now available in Android widget mode (accessing the external databases via a Webservice).
Android This function is now available for Android applications (accessing the external databases via a Webservice).
iPhone/iPad This function is now available for iPhone/iPad applications (accessing the external databases via a Webservice).
New in version 19
Android Widget This function is now available in Android widget mode (accessing the external databases via a Webservice).
Android This function is now available for Android applications (accessing the external databases via a Webservice).
iPhone/iPad This function is now available for iPhone/iPad applications (accessing the external databases via a Webservice).
Android Widget This function is now available in Android widget mode (accessing the external databases via a Webservice).
Android This function is now available for Android applications (accessing the external databases via a Webservice).
iPhone/iPad This function is now available for iPhone/iPad applications (accessing the external databases via a Webservice).
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
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)
END
SQLClose("REQ1")
Syntax
<Result> = SQLGetCol(<Query name> , <Column number>)
<Result>: Character string
Value of the column.
<Query name>: Character string
Name of the query created and executed with function SQLExec or executed with function SQLExecWDR.
Java The queries created in the query editor must be specified in the format of a character string.
Versions 16 and later
WEBDEV - Browser code Only the queries created and run by SQLExec are available.
New in version 16
WEBDEV - Browser code Only the queries created and run by SQLExec are available.
WEBDEV - Browser code Only the queries created and run by SQLExec are available.
<Column number>: Integer
Number of the column to retrieve. This column corresponds to a query column (and not to a table column). If several columns must be retrieved, the subscript of the columns must be specified in ascending order. For example, you must do SQLCol("QRY1", 1) then SQLCol("QRY1", 2).
WEBDEV - Browser codeJava The columns can be retrieved in any order.
Remarks

Current line in the query

The current line is positioned by SQLFetch.

Query columns

  • To read memo columns, use function SQLGetMemo. To read text memo columns, use function SQLGetTextMemo.
    PHP SQLGetMemo and SQLGetTextMemo are useless.
    Versions 16 and later
    WEBDEV - Browser code The memo columns cannot be read.
    New in version 16
    WEBDEV - Browser code The memo columns cannot be read.
    WEBDEV - Browser code The memo columns cannot be read.
  • The number of columns found in the query result is returned by the SQL.NbCol variable (assigned by SQLInfo).
  • If the column is numeric, the function SQLGetCol converts the result into a string. It is however possible in WLanguage to assign the result returned by the SQLGetCol function in a numerical Variable. The conversion is automatically performed by the WLanguage.
  • The columns must necessarily be retrieved in order of ascending number.
    WEBDEV - Browser codeJava The columns can be retrieved in any order.
  • The same column cannot be retrieved several times in a row. Indeed, the second time, the result will be an empty string.
    Versions 16 and later
    WEBDEV - Browser code The same column can be retrieved several times in a row.
    New in version 16
    WEBDEV - Browser code The same column can be retrieved several times in a row.
    WEBDEV - Browser code The same column can be retrieved several times in a row.
  • SQLGetCol cannot be used to retrieve the binary strings.

Query without result

The SQLGetCol function should not be called if the query did not return any results: you must test the Variable SQL.Outside after positioning yourself in the result of the query and before calling the SQLGetColfunction.
For example:
// Récupération de la valeur de la 1ère colonne du 1er enregistrement
Valeur is string
TexteRequête is string
TexteRequête = "SELECT NOMCLI, ADR1, ADR2, VILLE, CP FROM FACT"
SQLExec(TexteRequête, "REQ1")
Valeur = SQLGetCol("REQ1", 1)

Using tabulations in the items

The SQL functions are used to insert tabulations into the file items.
To get the value of the items (with Tabs), use SQLFetch/SQLGetCol.
Example: Function SQLGetCol and tabs in fields
The items of the records to retrieve are as follows:
Item 1Item 2
Record 1JohnSmith
Record 2John + tab + MacDoughnut
For the first record:
  • SQLGetCol(QRY, 1): retrieves John
  • SQLGetCol(QRY, 2): retrieves Smith
For the second record:
  • SQLGetCol(QRY,1 ): retrieves John + tab + Mac
  • SQLGetCol(QRY, 2): retrieves Doughnut
WINDEVWEBDEV - Server codeReports and QueriesWindowsJavaUser code (UMC)PHPAjaxHFSQLHFSQL Client/ServerHyper File 5.5OLE DB

SQLCol and SQLGetCol functions

SQLCol and SQLGetCol are equivalent during an OLE DB or HFSQL access. However, you must respect the type of browse associated with each one of these functions:
  • Function SQLCol: "SQLFirst/SQLCol" browse
  • Function SQLGetCol: "SQLFetch/SQLGetCol" browse
For more details, see Types of SQL browse.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
WINDEVWEBDEV - Server codeReports and QueriesWindowsJavaUser code (UMC)PHPAjaxODBC

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