PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • How to?
  • Creating a query in SQL code
  • Reverse engineering of query in SQL code
  • Execution modes of a query in SQL code
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
Overview
The query editor also allows you to create a query by typing SQL code (if you are familiar with this language).

Important

Reports & Queries cannot be used to create queries in SQL code using the INSERT, UPDATE or DELETE commands.
See the SQL commands available in an SQL query for more details. Remark: From version 19, HFSQL is the new name of HyperFileSQL.
How to?

Creating a query in SQL code

To create a query in SQL code:
  1. Click in the quick access buttons.
    • The element creation window appears: click "Query".
    • The query creation wizard starts.
  2. Specify that you want to create a query by entering the SQL code directly ("SQL code" option).
  3. If your project is linked to no analysis, specify the analysis to which the query will be attached.
    Validate the wizard screen.
  4. Type the query name (name of ".WDR" file corresponding to the query). This name will be used to identify the query in your programs.
  5. Specify the caption of the query by briefly describing the purpose of query. This caption will be used in the project documentation.
    Remark: The query name is automatically defined from the caption typed.
  6. Validate the query creation. A code window is displayed.
  7. Type the SQL code of your query. You can insert into the query:
    • comments by writing the "--" or "//" character in front of them. Only comments about the selection conditions will be taken into account during the reverse engineering of the query: the other comments will be automatically deleted. The comments about selection conditions with parameters will not appear when the query is tested (via "GO").
    • WLanguage functions. The WLanguage functions must be prefixed by "WL.". Assisted input is available. The WLanguage functions can be nested. Example:
      SELECT Customer.CustomerNum FROM Customer
      WHERE WL.LEFT(Customer.ZipCode,2)=75

      AndroidAndroid Widget Java You cannot execute queries with SQL code containing WLanguage functions.
  8. Save the SQL code ( Save ).
Versions 26 and later
Remark: Clicking on an identifier (file name, item name, parameter name) in the SQL code of the query highlights all occurrences of this identifier.
New in version 26
Remark: Clicking on an identifier (file name, item name, parameter name) in the SQL code of the query highlights all occurrences of this identifier.
Remark: Clicking on an identifier (file name, item name, parameter name) in the SQL code of the query highlights all occurrences of this identifier.

Reverse engineering of query in SQL code

Retroanalysis of the query in SQL code allows the query to be graphically represented from the data files found in the SQL code and in the project analysis.
To perform the reverse engineering of a query in SQL code:
  1. Display the SQL code of the query.
  2. To represent the query graphically, go to the "Query" pane, "Analyze" group and click "Reverse Engineering".
Limitations:
  • This feature is available for the SELECT, UPDATE, DELETE and INSERT queries.
  • Sub-queries are not imported.
  • Queries of queries are not supported.
  • UNION queries are not supported.
  • This feature is available only if the SQL commands used in the query are recognized by the HFSQL engine. For more details, see SQL commands available in an SQL query .
Execution modes of a query in SQL code
The query editor allows you to easily execute queries in SQL code. These queries can be:
Two execution modes are available for SQL queries:
  • Executing an SQL query while checking the SQL code: This option is available by default for all the SQL queries executed from WINDEV. The SQL code of the query must use the commands listed below. In this case, the HFSQL engine checks the SQL code of the query.
  • Executing an SQL query without checking the SQL code (with the hQueryWithoutCorrection constant): This option is recommended for queries executed via a native access or OLE DB. In this case, the HFSQL engine does not check the query. This option must be used if the query contains commands specific to a connection type (Oracle, SQL Server, etc.). All the SQL commands supported by the accessed database can be used.
Remark: The hQueryWithoutCorrection constant is also available when the query test is run from the query editor:
  • for a Select Query: click "Advanced" in the description window and check "Execute with hQueryWithoutCorrection in test mode" in the "hQueryWithoutCorrection" tab.
  • for an Insert query, an Update query or a Delete query: go to the "General" tab in the description window and check "Execute hQueryWithoutCorrection in test mode".
Minimum version required
  • Version 9
This page is also available for…
Comments
Example HexecuteSqlQuery with WHILE HOut() = False
numero_corrida é int = 0

MyProcedureUltimaCorrida é fonte de dados

IF HExecuteSQLQuery (MyProcedureUltimaCorrida, ConnNativa, hQueryWithoutCorrection, "NG0002_Procedure_UltimaCorrida") THEN

HReadFirst (MyProcedureUltimaCorrida, num_corrida)

ENQUANTO Hout () = False

ok = HReadNext (MyProcedureUltimaCorrida, num_corrida)

numero_corrida = MyProcedureUltimaCorrida.num_corrida

END

ELSE

Erro (HErrorInfo ())

END

Rastreio (numero_corrida)
BOLLER
29 Mar. 2019