|
|
|
|
|
- Overview
- What is an HFSQL context?
- Independent HFSQL context
- Transactions and independent HFSQL context
- Limitation: Data files in 5.5 format and views in Hyper File 5.5 format
- Limitation: Independent HFSQL context and use of an ODBC driver
- HFSQL contexts and windows
- How to manage the HFSQL context of a window?
- If the HFSQL contexts are not independent for each window (option not checked)
- If the HFSQL contexts are independent for each window (option checked)
- HFSQL contexts and reports
- How to manage the HFSQL context of a report?
- If the HFSQL contexts are not independent for each report
- If the HFSQL contexts are independent for each report
Managing the HFSQL contexts in the windows and in the reports
An HFSQL context contains information relative to the data used: - Information about the current record: record number, content of items, ...
- Values of HFound, HOut, ...
- Characteristics of current filter.
- Characteristics of current search.
- Characteristics of current browse.
- Name of opened files.
- Name and characteristics of queries (HExecuteSQLQuery, HExecuteQuery, SQLExec, SQLExecWDR).
Remark: A single transaction is allowed per HFSQL context. What is an HFSQL context? Independent HFSQL context WINDEV allows you to create independent HFSQL contexts: When opening the window (or the report), the existing HFSQL context is automatically "duplicated" (a copy of the existing context is created): the operations performed in each one of the contexts will be independent from the ones performed in the other contexts. The use of an independent context provides the same result as if two instances of the same application were running in parallel. The management of an independent HFSQL context is recommended for the MDI and multi-thread applications. The independent HFSQL context is taken into account: - When an HFSQL database is handled by the HFSQL functions (starting with the letter H).
- When an HFSQL database is handled by the SQL functions (starting with the letters SQL).
- When handling any database via an ODBC driver, by using the SQL functions.
Remarks: - From the global code of an MDI parent window, you cannot access a query run in a child window with an independent HFSQL context, even if the data source used is global to the project.
- All Native Connectors support independent HFSQL contexts: the context is copied and the operations performed are independent. However, some Native Connectors do not save the current position when copying the context.. In this case, it is necessary to set the position back to the current record after the context is copied..
Transactions and independent HFSQL context When copying a context, if a transaction is in progress on the first context, the new context is not in transaction. You must call HTransactionStart to start a transaction in the new context. Limitation: Data files in 5.5 format and views in Hyper File 5.5 format - Independent contexts are not supported by Hyper File 5.5 files.
- The copy of an HFSQL context (independent HFSQL context created from an existing context) fails if there is a Hyper File 5.5 view (HCreateView_55 kept for backward compatibility) in the original HFSQL context.
Limitation: Independent HFSQL context and use of an ODBC driver Caution: the query will be duplicated only if the copy of the context (window or report opening) is performed ONCE the browse was initialized by SQLFirst. | | Not to do
IF SQLExec("Query1") THEN Open(WIN_Result) END | Do
IF SQLExec("Query1") THEN SQLFirst("Query1") Open(WIN_Result) END |
HFSQL contexts and windows How to manage the HFSQL context of a window? To manage (or not) the independent HFSQL context of a window: - Display the window description.
- Go to the "Details" tab.
- If necessary, check "Independent HFSQL context".
If the HFSQL contexts are not independent for each window (option not checked) Whenever a window is opened, the HFSQL context is updated according to the operations performed in the window. All the windows work on the same HFSQL context. If the same window is opened several times in parallel in the application, the HFSQL contexts may overlap and the data used may not correspond to the expected data. If the HFSQL contexts are independent for each window (option checked) The current HFSQL context is entirely copied whenever a new window is opened. This allows you to perform different operations (filters, sorts, searches) on the same file, in windows opened in parallel. Each window has its own context. There is no risk of mixing up data. Each HFSQL context is independent, the record locks can be managed in each context. Closing a window with an independent context: - automatically unlocks the records locked by this window,
- will close the independent context.
Furthermore, an HFSQL function used in a context will have no effect outside this context. Therefore, if the memo management is enabled when opening the independent contexts, you have the ability to disable this feature in a window: disabling the memos will only be performed in the context corresponding to the window. HFSQL contexts and reports How to manage the HFSQL context of a report? To manage (or not) the independent HFSQL context of a report: - Open the report description (select "Report description" in the context menu).
- On the "Data" tab, check "The report execution does not affect iterations (independent HFSQL context)", if necessary.
If the HFSQL contexts are not independent for each report Whenever a report is printed, the HFSQL context is updated according to the operations performed in the report. All the reports currently printed use the same HFSQL context. If several reports simultaneously browse the same file, we recommend that you use independent HFSQL contexts. If the HFSQL contexts are independent for each report The current HFSQL context is entirely copied whenever a new report is printed. This allows you to perform different operations (filters, sorts, searches) on the same file, in reports opened in parallel. Each report has its own context. There is no risk of mixing up data.
Related Examples:
|
Training (WINDEV): WD Multi-Windowing
[ + ] This example presents the basic concepts for managing the multi-windowing and the dynamic tabs with WINDEV. This example includes a simple interface for managing the customer forms: - multi-windowing with MDI interface, - multi tabs with a dynamic tab control.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|