AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Gestión de desencadenadores / Funciones WLanguage
  • Trigger on the functions for manipulating Table controls
  • Variables used to manage the triggers
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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 and DELETE queries also trigger execution of the trigger (note: the trigger is not triggered on tables accessed via a Native Connector).
For more details, see Managing triggers.
HFSQL ClassicHFSQL Client/Server This function is only available on the client side. Use HDescribeServerTrigger to define a server trigger for an HFSQL Client/Server database.
Ejemplo
// In the initialization code of the project
LOCAL
	TriggerResult is boolean
// Create a trigger for all the analysis data 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
Sintaxis
<Result> = HDescribeTrigger(<List of HFSQL data files> , <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.
<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.
hTriggerAfterThe procedure is run after the HFSQL function.
hTriggerBeforeThe procedure is run before the HFSQL function.
Observaciones

Trigger on the functions for manipulating Table controls

Table field manipulation functions (TableAdd, TableAddLine, TableDelete, TableModify, etc.) implicitly use the following HFSQL functions: HAdd, HDelete and HModify.
When using one of these functions for handling tables, if a trigger is defined for the corresponding HFSQL function, the trigger is automatically activated.

Variables used to manage the triggers

A procedure (or stored procedure) of the trigger type receives no parameters. However, some HFSQL state variables are positioned before each call:
H.FileNameCharacter string: Logical name of the data file for which the trigger is activated.
Warning Depending on the logical name used by the application, the value of the variable H.FileName variable may be different (using aliases, for example). It is recommended to use:
  • MyFile.DescribedName to find out the logical name of the data file being manipulated (without taking aliases into account).
  • MyFile.PhysicalName to find out the physical name of the data file being manipulated.
H.ActionCharacter initialized to "A" for a Before trigger and to "P" for an After trigger.
H.TriggerFunctionString: Name of the HFSQL function that triggered the trigger.
Advertencia
The Variable H.FunctionTrigger is deprecated in favour of the variable H.FunctionTriggerNumber. The information given by the Variable is independent of the language used to run the application.
Novedad versión 2025
H.TriggerFunctionNumber
Constant used to identify the function that triggered the trigger:
  • htrgHAjoute The function that triggered the trigger is HAdd.
  • htrgHEcrit The function that triggered the trigger is HWrite.
  • htrgHModifies The function that triggered the trigger is HModify.
  • htrgHRaye The function that triggered the trigger is HCross.
  • htrgHSuppresses The function that triggered the trigger is HDelete.
H.ToDoDuring the execution of a before trigger:
  • cancelling the execution of the current 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).
  • cancelling the execution of the ongoing HFSQL function by assigning "E" to the HFSQL state variable: H.AFaire = "E". In this case, the action is not performed and the function (HAdd, HModify, etc.) returns False. The error message reads: "Action on data file XXX has been interrupted by the trigger".

Note In the case where a "BEFORE" and an "AFTER" trigger are associated with an HFSQL function, if the "BEFORE" trigger cancels the execution of the HFSQL function (by setting H.AFaire to "A"), the "AFTER" trigger is not triggered.
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
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
04 02 2015

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local