- Trigger on the table management functions
- Variables used to manage the triggers
In french: HDécritTrigger
Not available with these kinds of connection
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. The UPDATE, INSERT or DELETE requests also trigger execution (Warning: the trigger is not triggered on tables accessed via an Native Connector). .
Available only on the client side (use the HDescribeServerTrigger
function for a server at the HFSQL Client/Server database level.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
// Dans le code d'initialisation du projet
ResultatTrigger is boolean
// Création du Trigger pour tous les fichiers de l'analyse
ResultatTrigger = HDescribeTrigger("*", "HAJOUTE,HMODIFIE," + ...
"HSUPPRIME,HRAYE,HECRIT", "VerifDroitUtilisateur", hTriggerBefore)
// Avec "VerifDroitUtilisateur" une procédure globale du projet
IF ResultatTrigger = False THEN
Error("Erreur sur un trigger: " + HErrorInfo)
<Result> = HDescribeTrigger(<List of HFSQL data files> , <List of HFSQL functions> , <WLanguage procedure> , <Type of trigger>)
- True if the operation was performed,
- False if a problem occurred. HErrorInfo is used to identify the error.
<List of HFSQL data files>: Character string
Logical name of one or more HFSQL data files.
To specify several names of data files, the names of the data files must be separated by a comma (",").
To use all the data files found in the analysis, this parameter must be equal to "*".
<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.
|hTriggerBefore||The procedure is run before the HFSQL function.|
|hTriggerAfter||The procedure is run after the HFSQL function.|
Trigger on the table management functions
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.FileName||Character string: Logical name of the data file whose trigger is activated|
|H.Action||Character initialized to "A" for a Before trigger and to "P" for an After trigger.|
|H.TriggerFunction||Character string: Name of the HFSQL function that activated the trigger|
|H.ToDo||During 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".
: 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.
This page is also available for…
Not only on HFCS databases
According to the online help: HdescribeTrigger "Adds or modifies a trigger on a HFSQL data file"
I have used HdesdcribeTrigger on Postgresql databases also.