ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL
  • Overview
  • Several physical data files with an identical logical description
  • Several logical data files linked to a single physical data file
  • Handling the aliases through programming
  • The WLanguage functions
  • Create an alias on what?
  • Characteristics of an alias
  • Handling the alias file and its items
  • Triggers and aliases
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
Aliases on data files: HAlias
HFSQL ClassicHFSQL Client/ServerAvailable only with these kinds of connection
Overview
The aliases are used to handle:
  • Several physical data files with the same description in the analysis
  • Several logical data files described in the analysis that handle the same physical data file.
Caution: This help page explains how to create an alias with HAlias. Starting with version 27, you can use Alias variables. This type of variable makes it easier to create and handle aliases.

Several physical data files with an identical logical description

For example: You have the ability to manage at the same time:
  • The Customer2000.fic file that contains the backup of the customers for the year 2000
  • The Customer.fic file that contains the customer references for the current year
These two data files have the same logical description in the analysis: the CUSTOMER file. By default, the description of the CUSTOMER file in the analysis is linked to the Customer.fic file.
To use the Customer2000.Fic data file, you must "copy" the description of the CUSTOMER data file found in the analysis: to do so, create an alias with HAlias. The corresponding line of code is as follows:
HAlias(Customer, Customer2000)
The two files will be handled the same way with the HFSQL functions.

Several logical data files linked to a single physical data file

You have the ability to perform several parallel searches on the same physical data file or a search and a filter in parallel on the data file.
Example: The Customer.Fic data file is associated with the logical file named Customer in the analysis. To filter the records found in the Customer.fic data file and to browse at the same time all the records found in this data file, you must:
  • "Copy" the description of the CUSTOMER data file into the analysis: to do so, create an alias with HAlias.
  • Associate the description of the alias with the physical data file named Customer.Fic (HChangeName).
Remark: This method is used to manage several HFSQL contexts for the same physical data file.
Handling the aliases through programming

The WLanguage functions

Several functions are used to handle the aliases:
HAliasCreates a logical alias of a data file (or query) or cancels all existing aliases.
HCancelAliasCancels an alias that was declared beforehand by HAlias.
Other functions can intervene in the definition and use of aliases:
HChangeDirChanges the path to a data file (i.e. directory in which the file will be handled).
HChangeNameModifies the physical name of a data file.
Remark: Alias variables make it easier to create and modify aliases.

Create an alias on what?

You have the ability to create and handle aliases for the following elements:
  • Data file described in the analysis,
  • Data file described dynamically,
  • Query created in the query editor,
  • HFSQL Classic view,
  • Alias.

Characteristics of an alias

  • Physical data file associated with an alias:
    By default, the name specified for the alias is assigned to the physical data file corresponding to the alias. To associate the alias with a physical data file of different name, you must use HChangeName and HChangeDir.
  • Password of an alias:
    By default, the password of an alias file is identical to the password of the source data file. This password can be changed using HPass. The name of the data file used in this function corresponds to the name of the alias.
  • Re-indexing:
    The alias files can be re-indexed.
  • Automatic modification of the data files:
    This operation can be applied to the alias files.

Handling the alias file and its items

  • Code editor: To avoid the "Unknown identifier" error when using an alias file and its items, we recommend that you use a data source to declare the name of the alias before using HAlias.
    For example:
    Orders2000 is Data Source
    HAlias(Orders, Orders2000)

    Caution: the Extern keyword can be used but it slows down the execution significantly.
  • Window editor or page editor: the controls and the tables cannot be directly associated with the items found in the alias files. The controls must be assigned one by one through programming.
    Remark: to redefine the bindings through programming, you can use the ControlAlias function or the DataBinding property.

Triggers and aliases

Triggers can be defined on data file aliases.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/13/2023

Send a report | Local help