ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / Types of HFSQL variables
  • 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 are using the hBackupDescription variables:
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The hBackupDescription type is used to programmatically describe an HFSQL Client/Server backup.
This backup can be performed immediately or it can be scheduled.
You can define and change the characteristics of this backup using different WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// 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)
New in version 2025
// Upload a backup to an FTP server
Backup_Doc is hBackupDescription
Save_Doc.Description = "SaveWithRight"
Backup_Doc.WithIndex = True
Backup_Doc.Destination = "Back/RightBackup"
Save_Doc.Source = "Anonymization/*"

Sauvegarde_Doc.Ftp.Connexion.Serveur = "chorizo-2k8"
Save_Doc.Ftp.Connection.User = "TT"
Backup_Doc.Ftp.Connection.Password = "TT"
Save_Doc.Ftp.Connection.PortNumber = 22
Save_Doc.Ftp.Connection.ConnectionType = ftpModeActive
Backup_Doc.Ftp.DestinationPath = "/tmp"

// 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
Properties

WLanguage properties that can be used with the hBackupDescription type

The following properties can be used to define the characteristics of hBackupDescription variables:
NameType usedEffect
CompressionInteger constantUsed to compress (or not) the result of backup. This property can correspond to one of the following constants:
  • zipFormatAucun: No compression.
  • zipFormatZIP: Zip compression.
New in version 2025
Data masking
Integer constantAllows you to manage the anonymization of data contained in the backup:
  • hSvgAnonymizedAboutRights:
    Backup data is anonymized according to the rights of the user making the backup:
    • Administrator: all anonymized fields are unencrypted in the backup.
    • User without right to de-anonymize fields: all anonymized fields are hidden.
    • Users with the right to de-anonymize certain fields: only fields that can be de-anonymized are displayed in clear text in the backup. Other sections are hidden.
  • hSvgNonAnonymized (Default value):
    Fields are only non-anonymized if the administrator saves them. In other cases (users without the right to de-anonymize, or users with the right to de-anonymize certain fields), the backup fails.
  • hSvgAnyAnonymized Whatever the rights of the user making the backup, anonymized fields remain anonymized in the backup.
Warning: Restoring a backup with anonymized fields:
If the backup contains anonymized data, the data will remain anonymized when restored (and will therefore be unreadable, whatever the rights of the user wishing to access it).
DescriptionCharacter stringDescription associated with the backup.
This property is optional.
The backup description corresponds to an empty string ("") by default.
DestinationCharacter stringDestination 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%%"
New in version 2025
Attention In case of anonymization (property Anonymization property other than constant hSvgNonAnonymized), the backup destination must not correspond to a UNC.
EnabledBooleanUsed to manage the activation of a scheduled backup:
  • True if backup schedule is enabled: backup is performed according to the defined schedule.
  • False if backup scheduling is not enabled: backup is not performed.
New in version 2025
Ftp.Connection
ftpConnection variableCharacteristics of the connection to the FTP server to which the backup is to be copied.
If this property is not specified, no copy is made on the FTP server.
New in version 2025
Ftp.DestinationPath
Character stringBackup copy path on FTP server.
This property is only taken into account if the property Ftp.Connection property is set.
IdentifierIntegerBackup identifier.
This property is read-only.
LimitNumberBackupsIntegerMaximum 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".
ProcedureAfterCharacter stringName of the stored procedure used after the execution of the backup.
The procedure name is of the form: <Nom de la base de données>:<Nom de la collection de procédures>.<Nom de la procédure stockée>.

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".
ProcedureBeforeCharacter stringName of the stored procedure used before the execution of the backup.
The procedure name is of the form: <Nom de la base de données>:<Nom de la collection de procédures>.<Nom de la procédure stockée>.

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".
ProgressBarControl nameName 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.
SchedulingDifferentialhScheduling variableCharacteristics 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.
SchedulingFullhScheduling variableCharacteristics of a full scheduling. This property must be specified.
Source (*)Character stringFilter 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/*: Saves the entire database: data files, bindings, stored procedures, triggers.
  • Database name/Name Data file 1.fic: Saves the data file <Nom Fichier de données 1> from the database <Nom de la base de données>.
  • Database name 1/Name Data file 1.fic + TAB + Database name 2/Name Data file 2.fic + ... List of items to be saved. The separator can be the tabulation (TAB) or the semicolon (";").
  • System: Backup system databases (users, groups, rights).
This property must be specified.
UserCharacter stringUser who has created the backup.
This property is read-only.
WebhookAfterCharacter stringURL 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:
{
"identify": "283",
"destination": "c:\backup\283\monbackup.zip",
"state": "completed"
}
where:
  • "identifier" corresponds to the backup identifier.
  • "destination" corresponds to the backup destination.
  • "state" corresponds to the state of the backup. Different states are possible: 'completed', 'cancelled' or 'error'.
WithIndexBoolean
  • True if indexes 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.
Remarks

Limit on the number of backups (LimitNumberBackups property)

When the limit on the number of backups is defined (LimitNumberBackups different from 0):
  1. Before backup: search for similar backups (same source and 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).
  2. Running the "Before Procedure".
  3. Backup.
  4. Running the "After Procedure".
  5. 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.
Note 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 be saved>: String corresponding to the information to be saved. 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/*Backup the entire database: files, bindings, stored procedures, triggers.
    Database name/Name of File1Makes 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 (";").
    SystemMakes 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 be saved>: String corresponding to the information to be saved. 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/*Backup the entire database: files, bindings, stored procedures, triggers.
    Database name/Name of File1Makes 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 (";").
    SystemMakes 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.
  • <State>: integer (or integer-type constant) used to determine the status of the backup:
    hBackupCanceled2Backup canceled
    hBackupCompleted1Backup completed
    hBackupError3Error during backup
    hBackupInProgress0Backup in progress
  • <Error Message>: Error message if it exists in the form of a string.

Functions that are using the hBackupDescription variables:

HAddScheduledBackupAdds a scheduling for full backup (with or without differential backup) on the server defined by the connection.
HAddSchedulingAdds a new scheduled item to an HFSQL server: scheduled task (stored procedure), backup, optimization or refresh of a materialized view.
HBackupBacks up the contents of an HFSQL server: all server databases, one or more databases, one or more data files.
HDeleteSchedulingDelete a scheduled item on an HFSQL server: scheduled task (stored procedure), backup, optimization, refresh of a materialized view.
HExecuteSchedulingImmediately executes a scheduled item regardless of its scheduling: scheduled task (stored procedure), backup, optimization, refresh of a materialized view.
New in version 2025
HListHistoryPlanning
Lists the execution history of a scheduled item on an HFSQL server: scheduled task (stored procedure), backup, optimization, refresh of a materialized view).
HModifyScheduledBackupModifies a backup scheduling.
HModifySchedulingModify a scheduled item on an HFSQL server: scheduled task (stored procedure), backup, optimization, refresh of a materialized view.
New in version 2025
HSuppressHistoryPlanning
Deletes the execution history of a scheduled item on an HFSQL server: scheduled task (stored procedure), backup, optimization, refresh of a materialized view.).
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/06/2025

Send a report | Local help