ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL Client/Server functions
  • Rights required to perform a backup
  • Characteristics of the backup
  • Backup performed from the HFSQL Control Center
  • Scheduled backups
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Backs up the contents of an HFSQL server: all server databases, one or more databases, one or more data files.. This backup can be performed while one or more databases are being used.
The backup performed will correspond to the state of the database at the start of the backup: the backed-up database is consistent. Certain operations are prohibited during the backup: deleting data files and databases, updating stored procedures.
The backup can be described using a variable of type hBackupDescription. In this case, you have the ability to define:
  • a stored procedure to run BEFORE the backup. This procedure can cancel the backup if necessary.
  • a stored procedure to run AFTER the backup.
To restore this backup, use HRestoreBackup.
To delete this backup physically, use HDeleteBackup.
Example
MaConnexion is Connection

Sauvegarde_Doc is hBackupDescription
Sauvegarde_Doc.Description = "Sauvegarde Doc"
Sauvegarde_Doc.WithIndex = True
Sauvegarde_Doc.Destination = "Doc/Sauvegarde"
Sauvegarde_Doc.Source = "Doc/*"
Sauvegarde_Doc.ProcedureBefore = "mabase:ColDoc.Vérif" 
Sauvegarde_Doc.ProcedureAfter = "mabase:ColDoc.VérifSauvegarde"
HBackup(MaConnexion, Sauvegarde_Doc)
gcnxConnexion is Connection

// Sauvegarde la base de données wdcomptes dans le répertoire "Sauvegarde"
IF HBackup(gcnxConnexion, "wdcomptes/*", "wdcomptes/Sauvegarde", True, ...
		"Sauvegarde " + DateSys()) = 0 THEN
	Error(HErrorInfo(hErrFullDetails))
END
Syntax

Syntax that uses the hBackupDescription type (with call to stored procedures) Hide the details

<Result> = HBackup(<Connection> , <Backup definition>)
<Result>: Integer
  • Identifier of backup,
  • 0 if an error occurs. HErrorInfo is used to identify the error.
The HBackup function is not blocking: it launches the backup and gives control back to the application.
Note If a stored procedure is executed before saving and returns False then the save is cancelled.
<Connection>: Character string or Connection variable
Connection to the server to back up. This connection corresponds to:
<Backup definition>: hBackupDescription variable
Name of the hBackupDescription variable that contains the description of the backup to perform. This type of variable can also be used to define a stored procedure to be executed before saving and a stored procedure to be executed after saving.
Warning
Syntax kept for backward compatibility with version 12
<Result> = HBackup(<Connection> , <Data to back up> , <Backup destination> [, <Backup of indexes> [, <Description> [, <Progress Bar>]]])
<Result>: Integer
  • Identifier of backup,
  • 0 if an error occurs. HErrorInfo is used to identify the error.
The HBackup function is not blocking: it launches the backup and gives control back to the application.
<Connection>: Character string or Connection variable
Connection to the server to back up. This connection corresponds to:
<Data to back up>: Character string
Filter used to describe the information to back up. The possible values are as follows:
*Backs up all server databases, logs and system databases (users, groups, rights).
Database name/*Backup the entire database: data files, bindings, stored procedures, triggers.
Database name/Name file 1Backs up the <Name file 1> data file of the <Database name> database.
Name database 1/Name file 1 + TAB + Name database 2/Name file 2 + ...List of elements to back up. The separator can be the tabulation (TAB) or the semicolon (";").
SystemBacks up the system databases (users, groups, rights).
<Backup destination>: Character string
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.
<Backup of indexes>: Optional boolean
  • True (default) to back up the indexes,
  • False not to back them up. Not saving the indexes reduces the size of the backups. However, rebuilding the indexes will increase the restore time.
<Description>: Optional character string
Description of the backup.
<Progress Bar>: Optional control name
Name of the Progress Bar control in the window. This control is used to view the progress of the initialization step of the backup (and not the progress of the backup). This option is available in WINDEV only.
Remarks

Rights required to perform a backup

To perform a backup, the user or the group must have the rights to perform backups (hRightsBackup constant). These rights apply to the servers and to the databases.
To find out whether a user or a group has sufficient rights, use HInfoServerRights or HInfoDatabaseRights.
To modify the rights granted to a user or group of users, use HModifyServerRights or HModifyDatabaseRights.
New in version 2025
Warning If the backup concerns anonymized fields, it is possible to manage the backup mode for these fields. In this case, additional rights may be required. For more details, see the hBackupDescription variable type help.

Characteristics of the backup

The backup performed will correspond to the status of the database at the beginning of backup.
During the backup, you are not allowed to:
  • delete the data files and the databases,
  • update the stored procedures.

Backup performed from the HFSQL Control Center

A backup can be performed from the HFSQL Control Center. This backup is available in the "Backups" tab of the server description ("New backup" button).

Scheduled backups

You have the ability to schedule the backups performed on the server:
  • via the scheduled tasks managed by WLanguage (HAddTask).
  • via the HFSQL Control Center ("Scheduled Tasks" tab of the server description).
Related Examples:
WD Duplication Training (WINDEV): WD Duplication
[ + ] This educational example explains how to duplicate a database on a server.
The duplication is performed by programming and it allows you to give a new name to the database.
The example is based on the functions for saving and restoring a HFSQL backup.
Component: wd300hf.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
I'll teach you how to do a backup.
Na dica de hoje..
vou ensinar como fazer um backup
no inicio do sistema

In today's tip ..
I'll teach you how to do a backup.
At the beginning of the system

En el consejo de hoy ..
Voy a enseñar cómo hacer una copia de seguridad
en el inicio del sistema

// Blog com Video e Imagen

http://windevdesenvolvimento.blogspot.com.br/2017/04/aula-1112-windev-backuprestore-001.html

http://backup%20automatico%20quando%20abrir%20sistema%20-%20windev%20backup%20001/...

De matos
07 Apr. 2017

Last update: 06/12/2025

Send a report | Local help