This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Trigger on the table management functions
  • Variables used to manage the triggers
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Adds or modifies a trigger on an HFSQL data file. A trigger is a WLanguage procedure automatically called by the HFSQL engine whenever an HFSQL function is run. UPDATE, INSERT or DELETE queries also execute the trigger (Caution: the trigger is executed on tables accessed via a Native Connector).
For more details, see Managing triggers.
HFSQLHFSQL Client/Server This function is only available on the client side. Use HDescribeServerTrigger to define a server trigger for an HFSQL Client/Server database.
// Dans le code d'initialisation du projet
ResultatTrigger est un booléen
// Création du Trigger pour le fichier Client
ResultatTrigger = Client.DécritTrigger("HAJOUTE,HMODIFIE," + ...
 "HSUPPRIME,HRAYE,HECRIT", "VerifDroitUtilisateur", hTriggerAvant)
// Avec "VerifDroitUtilisateur" une procédure globale du projet
SI ResultatTrigger = Faux ALORS
 Erreur("Erreur sur un trigger: " + HErreurInfo)
<Result> = <HFSQL data file>.DescribeTrigger(<List of HFSQL functions> , <WLanguage procedure> , <Type of trigger>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HErrorInfo is used to identify the error.
<HFSQL data file>: File name
Logical name of an HFSQL data file.
<List of HFSQL functions>: Character string
Name of one or more HFSQL or TableXXX functions on which the trigger must be implemented. To specify several names of functions, the names of functions must be separated by a comma (","). You have the ability to define triggers on the following functions:
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure that will be run when a trigger is activated on the specified HFSQL functions.
<Type of trigger>: Integer constant
Indicates the type of trigger.
hTriggerAfterThe procedure is run after the HFSQL function.
hTriggerBeforeThe procedure is run before the HFSQL function.

Trigger on the table management functions

The table management functions (TableAdd, TableAddLine, TableDelete, TableModify, ... ) implicitly use the following HFSQL functions: <Source>.Add, <Source>.Delete and <Source>.Modify.
When using one of these functions for handling the tables, if a trigger is defined for the corresponding HFSQL function, the trigger is automatically activated.

Variables used to manage the triggers

A trigger procedure accepts no parameter. However, some HFSQL state variables are positioned before each call:
H.ActionCharacter initialized to "A" for a Before trigger and to "P" for an After trigger.
H.FileNameCharacter string: Logical name of the data file whose trigger is activated
H.ToDoDuring the execution of a before trigger:
  • cancel the execution of the HFSQL function by assigning "A" to the HFSQL state variable: H.ToDo = "A". In this case, the action is not performed and the function (HAdd, HModify, etc.) returns True (no error).
  • cancel the execution of the current HFSQL function by assigning "E" to the HFSQL state variable: H.ToDo = "E". In this case, the action is not performed and the function (HAdd, HModify, etc.) returns False. The error message is as follows: "The action on XXX file was interrupted by the trigger".
H.TriggerFunctionCharacter string: Name of the HFSQL function that activated the trigger

Remark: When a "BEFORE" trigger and an "AFTER" trigger are associated with an HFSQL function, if "BEFORE" cancels the execution of the HFSQL function (by setting H.ToDo to "A"), "AFTER" is not run.
Component: wd270hf.dll
Minimum version required
  • Version 25
This page is also available for…
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help