PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Trigger on the functions for handling tables
  • Variables used to manage the triggers
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
Adds or modifies a trigger on a HFSQL data file. A trigger is a WLanguage procedure automatically called by the HFSQL engine whenever a HFSQL function is run. See Managing the triggers for more details
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Example
// In the initialization code of the project
LOCAL
TriggerResult is boolean

// Create a trigger for all the analysis files
TriggerResult = HDescribeTrigger("*", "HADD,HMODIFY," + ...
 "HDELETE, HCROSS,HWRITE", "CheckUserRights", hTriggerBefore)
// "CheckUserRights" is a global procedure of the project
IF TriggerResult = False THEN
 Error("Error on a trigger: " + HErrorInfo)
 RETURN
END
Syntax
<Result> = HDescribeTrigger(<List of HFSQL Files> , <List of HFSQL Functions> , <Procedure Name> , <Type of Trigger>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<List of HFSQL Files>: Character string (with quotes)
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 (with quotes)
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:
<Procedure Name>: Character string
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.
hTriggerBeforeThe procedure is run before the HFSQL function.
hTriggerAfterThe procedure is run after the HFSQL function.
Remarks

Trigger on the functions for handling tables

The functions for handling tables (TableAdd, TableAddLine, TableDelete, TableModify, ... ) implicitly use the following HFSQL functions: HAdd, HDelete and HModify.
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.FileNameCharacter string: Logical name of the data file whose trigger is activated
H.ActionCharacter initialized to "A" for a Before trigger and to "P" for an After trigger.
H.TriggerFunctionCharacter string: Name of the HFSQL function that activated the trigger
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, ...) 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, ...) returns False. The error message is as follows: "The action on XXX file was interrupted by the trigger".
Note: When a "BEFORE" trigger and an "AFTER" trigger are associated with a HFSQL function, if the "BEFORE" trigger cancels the execution of the HFSQL function (by positioning H.ToDo to "A"), the "AFTER" trigger is not run.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Linux wd230hf.so
Windows Mobile wp230hf.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
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.
Diego Sanchez
Feb. 04 2015