PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Rights required to restore a backup
  • Restore operation performed from the HFSQL Control Center
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Used to restore:
  • an immediate backup (performed by HBackup or via the HFSQL Control Center).
  • Versions 15 and later
    a scheduled backup (described by HAddScheduledBackup or via the HFSQL Control Center).
    New in version 15
    a scheduled backup (described by HAddScheduledBackup or via the HFSQL Control Center).
    a scheduled backup (described by HAddScheduledBackup or via the HFSQL Control Center).
Versions 15 and later
The restored backup can be a full backup or a differential backup.
New in version 15
The restored backup can be a full backup or a differential backup.
The restored backup can be a full backup or a differential backup.
Caution: restoring a backup must be done with great care.
To perform this operation, you must have the rights to perform a backup (hRightsBackup) as well as the rights to lock the database (hRightsLock).
To restore the entire server (or the __jnl and __trs databases), no other application must be connected to the server. The connection used must not be attached to a database (during the call to HOpenConnection, the <Database> parameter must correspond to an empty string ("")).
To restore the databases, no connection must be established on the database to restore.
Duplicating a database: A special syntax of HRestoreBackup (syntax 2) is used to restore the backup of a database under a different name. This allows you to perform a copy of a database by renaming it. For example: to perform a copy of the MyDatabase2008 database by renaming it into MyDatabase2009, all you have to do is perform a backup of MyDatabase2008 and restore it under the MyDatabase2009 name.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 22 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
New in version 22
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
// Restore a backup
IF HRestoreBackup(ctServer, BackupID) = False THEN
Error("Failure restoring the backup" + HErrorInfo(hErrMessage))
END
// Restore a full and differential backup
BackupInfo = HInfoBackup(ctServer, BackupID)
BackupPath_Diff = ExtractString(BackupInfo, 4, TAB)

BackupInfo = HInfoBackup(ctServer, nBackupID_Full)
BackupPath_Comp = ExtractString(BackupInfo, 4, TAB)

IF HRestoreBackup(ctServer, BackupPath_Comp, BackupPath_Diff) = False THEN
Error("Failure restoring the backup" + HErrorInfo(hErrMessage))
END
Syntax

Restoring a backup from its identifier or from its path Hide the details

<Result> = HRestoreBackup(<Connection Name> , <Backup> [, <Progress Bar>])
<Result>: Boolean
  • True if the backup was restored,
  • False otherwise. HError is used to identify the error.
<Connection Name>: Character string (with or without quotes)
Name of connection to the server where the restore operation will be performed. This connection was defined in the data model editor, or by HDescribeConnection or HOpenConnection.
<Backup>: Integer or character string
Can correspond to:
  • Identifier of backup. This identifier can correspond to the identifier of full backup or to the identifier of differential backup.
    During an immediate backup, this identifier is returned by HBackup. This identifier can also be returned by HInfoBackup.
    During a scheduled backup, this identifier corresponds to the ..Identifier property of hBackupDescription variable.
  • Path and name of backup to restore. This name was specified during the backup. This name can also be returned by HInfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" sub-directory of HFSQL server. To specify the directory of Manta service, all you have to do is use "%%EXE%%".
<Progress Bar>: Optional character string (with or without quotes) or optional integer
  • Name of window where the progress bar will be displayed or name of Progress Bar control.
  • Identifier (Handle) of window that displays the progress bar.
WEBDEV - Server code This parameter is ignored.

Restoring a backup under a different database name Hide the details

<Result> = HRestoreBackup(<Connection Name> , <Backup> , <Source Database> , <Destination Database> [, <Progress Bar>])
<Result>: Boolean
  • True if the backup was restored,
  • False otherwise. HError is used to identify the error.
<Connection Name>: Character string (with or without quotes)
Name of connection to the server where the restore operation will be performed. This connection was defined in the data model editor, or by HDescribeConnection or HOpenConnection.
<Backup>: Integer or character string
Can correspond to:
  • Identifier of backup, returned by HBackup. This identifier can also be returned by HInfoBackup.
  • Path and name of backup to restore. This name was specified during the backup. This name can also be returned by HInfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" sub-directory of HFSQL server. To specify the directory of Manta service, all you have to do is use "%%EXE%%".
<Source Database>: Character string
Name of database to restore found in the backup. This syntax allows you to restore a single database found in the backup.
<Destination Database>: Character string
Name of database that will be restored. This name can differ from the source database. In this case, the function is used to perform a copy of database while renaming it.
<Progress Bar>: Optional character string (with or without quotes) or optional integer
  • Name of window where the progress bar will be displayed or name of Progress Bar control.
  • Identifier (Handle) of window that displays the progress bar.
WEBDEV - Server code This parameter is ignored.

Restoring a differential backup found in a specific directory (available from version 15) Hide the details

<Result> = HRestoreBackup(<Connection Name> , <Full Backup> , <Differential Backup> [, <Progress Bar>])
<Result>: Boolean
  • True if the backup was restored,
  • False otherwise. HError is used to identify the error.
<Connection Name>: Character string (with or without quotes)
Name of connection to the server where the restore operation will be performed. This connection was defined in the data model editor, or by HDescribeConnection or HOpenConnection.
<Full Backup>: Character string (with quotes)
Path and name of the full backup to restore. This name was specified during the backup. This name can also be returned by HInfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" sub-directory of HFSQL server. To specify the directory of Manta service, all you have to do is use "%%EXE%%".
<Differential Backup>: Character string (with quotes)
Path and name of the differential backup that must be applied to the full backup. This name was specified during the backup. This name can also be returned by HInfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" sub-directory of HFSQL server. To specify the directory of Manta service, all you have to do is use "%%EXE%%".
<Progress Bar>: Optional character string (with or without quotes) or optional integer
  • Name of window where the progress bar will be displayed or name of Progress Bar control.
  • Identifier (Handle) of window that displays the progress bar.
WEBDEV - Server code This parameter is ignored.
Remarks

Rights required to restore a backup

To restore 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.
  • the rights to lock the database (hRightsLock constant). These rights apply to the databases.
To find out whether these rights are granted to a user or to a group, use HInfoServerRights or HInfoDatabaseRights.
To modify the rights granted to a user or to a group of users, use HModifyServerRights or HModifyDatabaseRights.

Restore operation performed from the HFSQL Control Center

A backup can be restored from the HFSQL Control Center. This backup is available in the "Backups" 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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment