ph_backupdb PowerHome formula function
Description
Makes a copy of the PowerHome database.
Syntax
ph_backupdb ( target, replace )
Argument |
Description |
target |
String representing
the full path and filename to copy the database file to. This
value must be a fully qualified path and file name and cannot be a
relative path. |
replace |
Integer
representing whether to overwrite the file if it already exists.
Use 0 to keep an existing file, any other value to overwrite. |
Return value
Integer. Returns a 0 if the datbase file copy was
successful. Returns 1 if the target is not a fully qualified path and
filename. Returns 2 if the DBF path in the pwrhome.ini file is not a fully
qualified path and filename. Returns 3 if the target already exists and
the replace parameter is 0. Returns 4 if the SQL backup command fails.
Returns 5 if the backup file rename operation fails.
Notes
In order for this function to execute, the SALOGDIR
environment variable must be defined on the machine that PowerHome is
running on. This environment variable should be set to a directory where
the BACKUP.SYB temporary file that this function creates can reside.
Examples
The following examples demonstrate typical syntax/usage
for this function.
• ph_backupdb("C:\phdbabckup.db", 1)
Writes a backup file at the same location,
overwriting the prior file
•
ph_backupdb("C:\powerhome\Database\dbAutoBaks\ph-"+string(today(),"yymmdd")+".db",0)
Creates a file named "PH-" plus a date
string, thus >> "ph-130611.db".
This results in unique individual files that must
be trimmed occasionally to prevent runaway file clutter!