Home | Sign in | English EN

  • Triggers of the same type
  • Trigger on the functions for handling the Table controls
  • 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
<Connection variable>.DescribeServerTrigger (Function)
In french: <Variable Connexion>.DécritTriggerServeur
HFSQL Client/ServerAvailable only with this kind of connection
Adds or modifies a server trigger. A server trigger is a stored procedure automatically called by the HFSQL engine whenever an HFSQL function is run.
Remark: The functions for handling the server triggers are advanced functions. The server triggers can be created directly in the data model editor. For more details, see Server triggers.
// Connection
CNT_TEST is Connection
// Create a data file
IF Cedex.Creation() = False THEN
Info("File created")
// Change data file directory
IF Cedex.ChangeDir(".\FRANCE\") = False THEN Error(HErrorInfo())
// Create a trigger on an HFSQL Client/Server data file
IF CNT_TEST.DescribeServerTrigger("TriggerTEST", ...
"ProcedureTEST", hTriggerAfter, ...
"Cedex", "HAdd, HModify") = False THEN Error(HErrorInfo())
// Add records
Cedex.ZipCode = "30000"
Cedex.City = "NIMES"
Cedex.ZipCode = "34000"
Cedex.City = "MONTPELLIER"

Describing a server trigger on the physical files associated with a connection Hide the details

<Result> = <Connection>.DescribeServerTrigger(<Trigger> , <Stored procedure> , <Type of trigger> [, <Physical HFSQL Client/Server files> [, <List of HFSQL functions>]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurs. HError is used to identify the error.
<Connection>: Connection variable
Name of the Connection variable that describes the connection to use.
<Trigger>: Character string
Name of the trigger to create. This name will be used to handle the trigger in the functions for managing the server triggers.
<Stored procedure>: Procedure name
Name of the WLanguage stored procedure that will be run when activating the trigger. This procedure accepts no parameter.
<Type of trigger>: Integer constant
Type of trigger to create:
hTriggerAfterThe stored procedure is run after the HFSQL function
hTriggerBeforeThe stored procedure is run before the HFSQL function
<Physical HFSQL Client/Server files>: Optional character string
Physical name of one or more HFSQL Client/Server data files associated with the connection ("CUSTOMER.FIC" for example). To specify several names, the names of the data files must be separated by a comma (","). If this parameter is not specified or if it corresponds to an empty string (""), the trigger will be enabled on all the data files of the database.
<List of HFSQL functions>: Optional 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 (","). Triggers can be defined on the following functions: Triggers are also run on INSERT queries (trigger of <Source>.Add), UPDATE queries (trigger of <Source>.Modify) and DELETE queries (trigger of <Source>.Delete).

Triggers of the same type

If several triggers of the same type are defined on the same data file for the same operation, these triggers will be run according to the alphabetical order of their names.

Trigger on the functions for handling the Table controls

The functions for handling the Table controls (<Table>.Add, <Table>.AddLine, <Table>.Delete, <Table>.Modify, ... ) implicitly use the following HFSQL functions: <Source>.Add, <Source>.Delete and <Source>.Modify.
When using one of these functions for handling the Table controls, 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 the Before trigger, the execution of the current HFSQL function can be canceled by assigning "A" to the HFSQL state variable: H.ToDo = "A"
H.TriggerFunctionCharacter string: Name of HFSQL function that activated the trigger.

Remark: If a BEFORE trigger and an AFTER trigger are defined for a HFSQL function and if the BEFORE trigger cancels the function (H.ToDo is set to "A"), then the AFTER trigger is not activated.
Component: wd270hf.dll
Minimum version required
  • Version 25
This page is also available for…
Click [Add] to post a comment