- How to?
- Creating a query in SQL code
- Reverse engineering of query in SQL code
- Execution modes of a query in SQL code
Creating a query in SQL code
Creating a query in SQL code
To create a query in SQL code:
- Click in the quick access buttons.
- The creation window appears: click "Query".
- The query creation wizard starts.
- Specify that you want to create a query by entering the SQL code directly ("SQL code" option).
- If your project is linked to no analysis, specify the analysis to which the query will be attached.
Validate the wizard screen.
- Type the query name (name of ".WDR" file corresponding to the query). This name will be used to identify the query in your programs.
- 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.
- Validate the query creation. A code window is displayed.
- Type the SQL code of your query. You can insert into the query:
- Save the SQL code ().
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:
- Display the SQL code of the query.
- To represent the query graphically, go to the "Query" tab, "Analyze" group and click "Reverse Engineering".
- 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".
This page is also available for…