- Operating mode of HCopyFile
- Use conditions
- Names of data files and directories on the server
In french: HCopieFichier
Available only with this kind of connection
Copies an HFSQL data file (.fic, .ndx, .ftx and .mmo files if they exist):
- from the HFSQL server to the server (to perform a backup for example).
- from the HFSQL server to the client (to perform a local backup for example).
- from the client to the HFSQL server (to update the data files for example).
- from an HFSQL server to another HFSQL server.
// Copy the data files from server to server
// while renaming and changing directory
HCopyFile(MyConnection, ".\backup\customerfile_bck.fic", MyConnection, ".\customerfile.fic")
// Copy the data files from the server to the client computer
HCopyFile("", "C:\Data\Customer.fic", MyConnection, "customer.fic")
// Copy the data files from the client computer to the server
HCopyFile(MyConnection, "customer.fic", "", "C:\Data\Customer.fic")
// Copies the data file(s) from a server to another server
HCopyFile("CNT", "customer.fic", "CNT2", "dir\customer.fic", hNoIndex, PROGBAR_MyProgressBar)
// Copy the CUSTOMER data file to itself (save)
sMyDestinationDirectory is string = CompleteDir(fExeDir()) + "TestDirectory"
IF NOT fDirectoryExist(sMyDestinationDirectory) THEN fMakeDir(sMyDestinationDirectory)
HCopyFile("", sMyDestinationDirectory + "CUSTOMER.FIC", "", ...
CompleteDir(fExeDir()) + "CUSTOMER.FIC", hCopyIndex)
// Usage example of HCopyFile in Android
// (from the HFSQL C/S server to the Android device)
HFCSConnection is Connection
// Connection parameters
HFCSConnection.Provider = hAccessHFClientServer
HFCSConnection.User = "admin"
HFCSConnection.Password = ""
HFCSConnection.Server = "192.168.40.26"
HFCSConnection.Database = "mydatabase"
sDBPath is string = (SysDirStorageCard() + [fSep] + ProjectInfo(piProjectName)
IF NOT HCopyFile("", sDBPath + [fSep] + "copy/customer.fic", ...
HFCSConnection, CUSTOMER.Name + ".fic") THEN
<Result> = HCopyFile(<Destination connection> , <Destination data file> , <Source connection> , <Source data file> [, <Copy mode> [, <Progress Bar control> [, <Password>]]])
- True if the data file was copied,
- False if an error occurred. HError is used to identify the error.
<Destination connection>: Character string or Connection variable
Connection to which the data file must be copied. This connection corresponds to:If this parameter corresponds to an empty string, the destination will be the local computer.
<Destination data file>: Character string
Name and path of destination data file. The path and this data file are automatically created if they do not exist on the server.
If the destination data file is found on the server, the path is relative to the database.
Caution: the extension of the '.fic' file must be specified.
<Source connection>: Character string or Connection variable
Connection from which the data file must be copied. This connection corresponds to:
<Source data file>: Character string
Name and path of source data file (to copy). If the source data file is found on the server, the path is relative to the database.
- the extension of the '.fic' file must be specified.
- the '.mmo' file, if any, will be automatically copied.
<Copy mode>: Optional Integer constant
Copy mode used:
|hCopyIfNotFound||Copies the data file only if it does not exist at the specified location on the destination computer.|
|hCopyIndex||The file indexes are copied (NDX file and FTX file if it exists).|
|hCreateIndex||The file indexes are not copied (NDX file and FTX file if it exists). They are automatically re-created on the destination via a reindex operation. |
If the data file is password-protected, the <Password> parameter must be specified.
|hNoIndex||The file indexes are not copied (NDX file and FTX file if it exists).|
<Progress Bar control>: Optional control name
Name of Progress Bar control found in the window, used to show the progress of copy.
<Password>: Optional character string
File password (if it exists). This password is required if the hCreateIndex constant is used.
Operating mode of HCopyFile
- The copied data file is unlocked, as well as the records found in the data file.
- The index is not copied if it does not exist or if it is corrupted.
- The password is not required to copy the data file. However, the copied data file remains password-protected.
- It is not possible to copy data files to a source server of a SPARE replication server.
- Data file in transaction: before copying the data file, we advise you to:
- You can also copy a data file from the client computer to the same client computer. In this case, this function is equivalent to fCopyFile.
- This function is used to copy files to an HFSQL server (in Client/Server mode). This function cannot be used with an external server (Oracle or other).
- To copy an HFSQL data file from a local computer to the server, all the users must have freed such file beforehand. No connection to the data file must be in progress, or the copy will fail. To prevent any new connection to the data file, you can:
- Case of replicated data files (replication between servers): For a replicated data file, HCopyFile must not be used to copy a data file to the server: the copy is not possible. However, a data file can be copied from the server to the client computer.
Names of data files and directories on the server
- The name of data files (.fic, .ndx, .ftx and .mmo files if they exist) on the server must contain no accented characters.
- On a LINUX server, the name of the data files must be written in lowercase characters.
This page is also available for…