|
|
|
|
|
HAddTask (Function) In french: HAjouteTâche
Available only with this kind of connection
Adds a scheduled task on an HFSQL server. Compatibility with version 12: For compatibility with version 12, it is also possible to define a task using the HScheduledTask structure.. This task will run the specified stored procedure (or will perform a database backup).  To define a scheduled element (scheduled task, backup, optimization or refresh of a materialized view, it is recommended to use the function HAddScheduling. MyTask is hScheduledTask
MyTask.Description = "Scheduled backup " + CR + ...
DateToString(DateSys(), maskSystemDate) + " at "+ TimeToString(TimeSys(), "HH:MM:SS")
MyTask.Month = "*"
MyTask.DayOfWeek = "*"
MyTask.DayOfMonth = "*"
MyTask.Hour = EDT_Time.Hour
MyTask.Minute = EDT_Time.Minute
MyTask.NumberExecution = 1
MyTask.Procedure = "HBackup"
Add(MyTask.Parameter, gsNameCSDatabase + "/LOG_TASKSFIC")
Add(MyTask.Parameter, gsNameCSDatabase + ".ScheduledBackup")
Add(MyTask.Parameter, True)
Add(MyTask.Parameter, MyTask.Description)
nID is int = HAddTask(gsCSConnection, MyTask)
Syntax
Creating a task from an hScheduledTask variable Hide the details
<Result> = HAddTask(<Connection> , <Scheduled task>)
<Result>: Integer - Identifier of scheduled task,
- -1 if an error occurred. HErrorInfo is used to identify the error.
<Connection>: Character string or Connection variable Connection for which a task must be added. This connection corresponds to: <Scheduled task>: hScheduledTask variable Name of the hScheduledTask variable used.
Creating a task from the hScheduledTask structure (compatibility with version 12) Hide the details
<Result> = HAddTask(<Connection> , <Stored procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Character string - Identifier of scheduled task,
- -1 if an error occurred. HErrorInfo is used to identify the error.
<Connection>: Character string or Connection variable Connection for which a task must be added. This connection corresponds to: <Stored procedure>: WLanguage procedure Name of WLanguage stored procedure that will be run when triggering the task. This parameter has the following format: "<Database name>\<Name of stored procedure>". If this name corresponds to "HBackup", the scheduled task will perform a backup. <Parameter 1>: Type of optional parameter Parameter that will be passed to the stored procedure. In the case of a backup, the parameters to be passed are those of HBackup, except for the connection. <Parameter N>: Type of optional parameter Parameter that will be passed to the stored procedure. In the case of a backup, the parameters to be passed are those of HBackup, except for the connection. Remarks Necessary rights To add a task, you must have: - the corresponding rights (hRightsManageTask constant) on the server,
- the rights to connect (hRightsConnection or hRightsEncryptedConnection) to each relevant database,
- the rights to run the command linked to the scheduled task.
The task will be run with the account of user who created the task. Caution: If the server is switched off, the scheduled task will not be performed.. The scheduled task will be performed at the next available date when the server is switched on.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|