|
|
|
|
|
- WLanguage properties that can be used with the hBackupDescription type
- Limit on the number of backups (LimitNumberBackups property)
- Parameters of the stored procedure called BEFORE the backup
- Parameters of the stored procedure called AFTER the backup
- Functions that use hBackupDescription variables:
hBackupDescription (Type of variable) In french: hDescriptionSauvegarde
Available only with this kind of connection
The hBackupDescription type is used to programmatically describe an HFSQL Client/Server backup. This backup can be performed immediately or it can be scheduled. The characteristics of this backup can be defined and changed using different WLanguage properties. Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
// Describe an immediate backup Backup_Doc is hBackupDescription Backup_Doc.Description = "Doc Backup" Backup_Doc.WithIndex = True Backup_Doc.ProgressBar = "PROGBAR_MyProgressBar" Backup_Doc.Destination = "Doc/Backup" Backup_Doc.Source = "Doc/*" Backup_Doc.ProcedureBefore = "mydatabase:DocCol.Check" Backup_Doc.ProcedureAfter = "mydatabase:DocCol.CheckBackup" Backup_Doc.LimitNumberBackups = 5 // Save backup HBackup(MyConnection, Backup_Doc)
// Create a scheduled backup every 5 minutes // with a differential backup every minute hBck is hBackupDescription hBck.Enabled = True hBck.WithIndex = True hBck.Description = "Scheduled backup every N minutes " + ... " with a differential backup every minute on the database " + ...  cnt.Database + " created on "+ DateToString(DateSys(), maskDateSystem) + ... " at " + TimeToString(TimeSys(), "HH:MM:SS:CC") hBck.Destination = "Backup_"+ cnt.Database hBck.LimitNumberBackups = 2 hBck.Source = cnt.Database hBck.SchedulingFull.Month = "*" hBck.SchedulingFull.DayOfMonth = "*" // Define the scheduling dtServerDateTime is DateTime = HInfoServer(cnt, hInfoDate) dtServerDateTime.Minute++ hBck.SchedulingFull.Hour = dtServerDateTime.Hour hBck.SchedulingFull.Minute = dtServerDateTime.Minute hBck.SchedulingFull.DayOfWeek = "*" hBck.SchedulingFull.DayOfMonthOrDayOfWeek = False hBck.SchedulingDifferential.Month = "*" hBck.SchedulingDifferential.DayOfMonth = "*" hBck.SchedulingDifferential.Hour = "*" hBck.SchedulingDifferential.Minute = "*" hBck.SchedulingDifferential.DayOfWeek = "*" hBck.SchedulingDifferential.DayOfMonthOrDayOfWeek = False  // Add the scheduled backup IF HAddScheduledBackup(cnt, hBck) = False THEN Error("Failure creating the scheduled backup", HErrorInfo(hErrFullDetails)) RETURN END
Remarks WLanguage properties that can be used with the hBackupDescription type The following properties can be used to handle a hBackupDescription variable. | | | Name | Type used | Effect |
---|
Compression | Integer constant | Used to compress (or not) the result of backup. This property can correspond to one of the following constants:- zipFormatNone: No compression.
- zipFormatZIP: Compression in Zip format.
| Description | Character string | Description associated with the backup. This property is optional. The backup description corresponds to an empty string ("") by default. | Destination | Character string | Destination of the backup (name and destination of the backup). The backup will be preformed on the server, in a location defined by this name. If this name corresponds to a relative path, the backup will be placed in the "Backup" subdirectory of the HFSQL server. To specify:- the directory of the Manta service, use the "%%EXE%%" character string.
- the year, use the "%%YEAR%%" character string (2008 for example).
- the month on 2 digits, use the "%%MONTH%%" character string (03 for example).
- the day, use the "%%DAY%%" character string.
- the hour, use the "%%HOUR%%" character string.
- the minutes, use the "%%MINUTE%%" character string.
Examples: - To store the backup in a directory that corresponds to the year, day, and time in the "Backup" subdirectory, use:
// Store backup in 2021_21_13 Backup_Doc.Destination="%%YEAR%%_%%DAY%%_%%HOUR%%"
- To save the backup in a "Doc/Backup" directory at the same level as the Manta service directory, use:
Backup_Doc.Destination="%%EXE%%/Doc/Backup/%%YEAR%%"
| Enabled | Boolean | Used to manage the activation of a scheduled backup: - True if the backup scheduling is enabled: the backup is performed according to the scheduling.
- False if the backup scheduling is not enabled: the backup is not performed.
| Identifier | Integer | Backup identifier. This property is read-only. | LimitNumberBackups | Integer | Maximum number of backups of the same type to perform. There is no limit if this number corresponds to 0. If the number of backups exceeds the limit value, some former backups will be removed from the server. For more details, see "Operating mode of the limit regarding the number of backups". | ProcedureAfter | Character string | Name of the stored procedure used after the execution of the backup. The procedure name has the following format: <Database name>:<Name of set of procedures>.<Name of stored procedure>.
This property is optional. No procedure is run if this property is not defined.
For more details, see "Parameters of the stored procedure called AFTER the backup". | ProcedureBefore | Character string | Name of the stored procedure used before the execution of the backup. The procedure name has the following format: <Database name>:<Name of set of procedures>.<Name of stored procedure>.
This property is optional. No procedure is run if this property is not defined.
For more details, see "Parameters of the stored procedure called BEFORE the backup". | ProgressBar | Control name | Name of the Progress Bar control used in the window to view the progress of the initialization step of the backup (and not the progress of the backup).
Optional property available in WINDEV only. | SchedulingDifferential | hScheduling variable | Characteristics of a differential scheduling. You have the ability to define both a full scheduling and a differential scheduling. No differential scheduling can be performed on its own. This property is optional. | SchedulingFull | hScheduling variable | Characteristics of a full scheduling. This property must necessarily be specified. | Source (*) | Character string | Filter used to define the data to back up. The possible values are:- *: Makes a backup copy of all the databases of the server, the logs, the system databases (users, groups, rights).
- Database name/*: Makes a back up copy of the entire database: files, links, stored procedures, triggers.
- Database name/Name of File1: Makes a back up copy of <Name of File1> found in <Database name>
- Name of database 1/Name of File1 + TAB + Name of database 2/Name of File2 + ...: List of elements to back up. The separator can be the tabulation (TAB) or the semicolon (";").
- System: Makes a backup copy of the system databases (users, groups, rights).
This property must necessarily be specified. | User | Character string | User who has created the backup. This property is read-only. | WebhookAfter | Character string | URL of a REST service that will be triggered after the backup and the procedure specified with the ProcedureAfter procedure (if it exists). A POST request will be performed on the provided URL. The URL receives an "application/json" content corresponding to the information on the backup. For example: { "identifier": "283", "destination": "c:\backup\283\mybackup.zip", "state": "completed" } where: - "identifier" corresponds to the backup identifier.
- "destination" corresponds to the backup destination.
- "state" corresponds to the state of the backup. There are different states: 'completed', 'canceled' or 'error'.
| WithIndex | Boolean | - True if indices must be backed up,
- False otherwise.
This property is optional. By default, the backup copy of the indexes is made. |
The properties followed by (*) are mandatory. Limit on the number of backups (LimitNumberBackups property) When the limit on the number of backups is defined (LimitNumberBackups different from 0): - Before the backup: Search for the former similar backups (same source and same destination). If these backups are in error, the files of the backup will be erased from the disk (but the backup will remain in the history of backups).
- Running the "Before Procedure".
- Backup.
- Running the "After Procedure".
- If the number of similar backups (same source and same destination) successfully performed is greater than the limit value, the server will delete some of these backups and will remove them from the history. This deletion starts from the oldest backup until the number of backups is equal to the requested value.
Remark: This property can be used to implement a specific backup system. For example: - A daily backup while storing the last 7 backups.
- A weekly backup while storing the last 4 backups.
- A monthly backup while storing the last 6 backups.
Parameters of the stored procedure called BEFORE the backup The stored procedure called BEFORE the backup can take parameters. This procedure has the following format: PROCEDURE <Procedure name>(<Data to back up>, ... <Backup destination>, <Description>) These parameters are optional. They will allow you to handle the following indications in the code of the stored procedure: - <Data to back up>: Character string corresponding to the information to back up. Corresponds to the Source property. The possible values are as follows:
| | * | Makes a backup copy of all the databases of the server, the logs, the system databases (users, groups, rights). | Database name/* | Makes a back up copy of the entire database: files, links, stored procedures, triggers. | Database name/Name of File1 | Makes a back up copy of <Name of File1> found in <Database name> | Name of database 1/Name of File1 + TAB + Name of database 2/ Name of File2 + ... | List of elements to back up. The separator can be the tabulation (TAB) or the semicolon (";"). | System | Makes a backup copy of the system databases (users, groups, rights). |
- <Backup destination>: Name and destination of the backup. Corresponds to the Destination property. The backup will be preformed on the server, in a location defined by this name. If this name corresponds to a relative path, the backup will be placed in the "Backup" subdirectory of the HFSQL server. To specify:
- the directory of the Manta service, use the "%%EXE%%" character string.
- the year, use the "%%YEAR%%" character string (2008 for example).
- the month on 2 digits, use the "%%MONTH%%" character string (03 for example).
- the day, use the "%%DAY%%" character string.
- the hour, use the "%%HOUR%%" character string.
- the minutes, use the "%%MINUTE%%" character string.
- <Description>: Backup description. Corresponds to the Description property.
Parameters of the stored procedure called AFTER the backup The stored procedure called AFTER the backup can take parameters. This procedure has the following format: PROCEDURE <Procedure name>(<Data to back up>, <Backup destination>, ... <Description>, <Status>, <Error message>) These parameters are optional. They will allow you to handle the following indications in the code of the stored procedure: - <Data to back up>: Character string corresponding to the information to back up. Corresponds to the Source property. The possible values are as follows:
| | * | Makes a backup copy of all the databases of the server, the logs, the system databases (users, groups, rights). | Database name/* | Makes a back up copy of the entire database: files, links, stored procedures, triggers. | Database name/Name of File1 | Makes a back up copy of <Name of File1> found in <Database name> | Name of database 1/Name of File1 + TAB + Name of database 2/ Name of File2 + ... | List of elements to back up. The separator can be the tabulation (TAB) or the semicolon (";"). | System | Makes a backup copy of the system databases (users, groups, rights). |
- <Backup destination>: Name and destination of the backup. Corresponds to the Destination property. The backup will be preformed on the server, in a location defined by this name. If this name corresponds to a relative path, the backup will be placed in the "Backup" subdirectory of the HFSQL server. To specify:
- the directory of the Manta service, use the "%%EXE%%" character string.
- the year, use the "%%YEAR%%" character string (2008 for example).
- the month on 2 digits, use the "%%MONTH%%" character string (03 for example).
- the day, use the "%%DAY%%" character string.
- the hour, use the "%%HOUR%%" character string.
- the minutes, use the "%%MINUTE%%" character string.
- <Description>: Backup description. Corresponds to the Description property.
- <Status>: integer (or Integer constant) used to find out the status of the backup:
| | | hBackupCanceled | 2 | Backup canceled | hBackupCompleted | 1 | Backup completed | hBackupError | 3 | Error during backup | hBackupInProgress | 0 | Backup in progress |
- <Error message>: Error message (if it exists) in character string format.
Functions that use hBackupDescription variables: | | HAddScheduledBackup | Adds a scheduling for full backup (with or without differential backup) on the server defined by the connection. | HBackup | Makes a backup copy of the content of an HFSQL server: all databases on the server, one or more databases, one or more data files. | HListScheduledBackup | Lists the full and differential backups that have been scheduled on HFSQL Client/Server. | HModifyScheduledBackup | Modifies a backup scheduling. |
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|