PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Overview
  • What is a 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
  • Limitations: RPC and independent HFSQL context
  • 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
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
Managing the HFSQL contexts in the windows and in the reports
Overview
A 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 the current filter
  • Characteristics of the current search
  • Characteristics of the current browse
  • Name of opened files
  • Name and characteristics of queries (HExecuteSQLQuery, HExecuteQuery, SQLExec, SQLExecWDR)
Note: A single transaction is allowed per HFSQL context.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
What is a 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 a HFSQL database is handled by the HFSQL functions (starting with the letter H).
  • When a 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.
The "Independent HFSQL context" option is currently supported by the following databases:
  • HFSQL and HFSQL Client/Server
  • Native Oracle Access
  • Native SQL Server Access
  • Native Sybase Access
  • Native AS400 Access
  • Native Progress Access
  • Any database via ODBC (SQL commands)
The "Independent HFSQL context" option is not supported by the following databases:
  • Native Informix Access
  • Native DB2 Access
  • Native MySQL Access
  • Native PostgreSQL Access
  • Versions 16 and later
    Native SQLite access
    New in version 16
    Native SQLite access
    Native SQLite access
  • Native xBase access
  • Native XML access
  • Any database via OLE DB (or ODBC via OLE DB)
Notes:
  • 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 the Native Accesses support the independent HFSQL contexts. However, the copy of context is not supported by some Native Accesses: you have the ability to start and perform a browse in the independent contexts. But you cannot continue in a new context a browse started in a first context.
Indeed, the source variable used refers to the current HFSQL context. Depending on the location where this variable is used, the HyperFileSQL context can or cannot recognize this data source.

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

  • The independent contexts are not supported by the Hyper File 5.5 files.
  • The copy a HFSQL context (creation of an independent HFSQL context from the existing context) fails if a Hyper File 5.5 view (HCreateView_55) is found in the initial HFSQL context.

Limitations: RPC and independent HFSQL context

The access to a HFSQL file via RPC is not allowed from a window or from a report with an independent context.
The "Independent HyperFileSQL context" option must be disabled.
To disable this option:
  • In a window: In the "Details" tab of window description, uncheck "Independent HyperFileSQL context".
  • In a report: In the "Data" tab of report description, uncheck "The execution of the report does not affect the browse operations (independent HyperFileSQL context)".
The "Independent HFSQL context" option must be disabled.
To disable this option:
  • In a window: In the "Details" tab of window description, uncheck "Independent HFSQL context".
  • In a report: In the "Data" tab of report description, uncheck "The execution of the report does not affect the browse operations (independent HFSQL context)".
In an application that is using the remote access, if independent contexts must be used, they must be programmed by HSavePosition and HRestorePosition.
Note: The contexts cannot be copied in RPC. You must use HOpenAnalysis or HConnectRemoteAccess in the new context to access the RPC.

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:
  1. Display the window description.
  2. Display the "Details" tab.
  3. Check (or not) "Independent HyperFileSQL context".Check (or not) "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, a 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:
  1. Display the description of the report ("Description" from the popup menu of the report).
  2. In the "Data" tab, check (or not) "The report execution does not affect the browses (independent HyperFileSQL context)".In the "Data" tab, check (or not) "The report execution does not affect the browses (independent HFSQL context)".

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:
WD Multi-Windowing 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.
See also
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment