AUDITDB - Control the auditing database

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

AUDITDB - Control the auditing database

Syntax:

AUDITDB

[ file name ]  |  [ /options ]

Arguments:

[ file name ]

Optional variable or string defining a database file name or DSN name; if no path is defined the alternate default path is used.

Options:

/new

Reset the auditing database to an empty state.

 

/odbc

Use an ODBC Data Source Name (DSN) instead of a filename.

 

/pw=xx

Optional password to use with the /odbc option

 

/user=xx

Optional username to use with the /odbc option.

 

 

This script command is used to control the auditing database. The auditing database simplifies the process of developing fault-tolerant Robo-FTP scripts. For example, if Robo-FTP terminates unexpectedly due to an unscheduled system reboot, scripts that use an auditing database can be re-launched from the beginning and they will not repeat certain tasks that were successfully completed by the previous instance.

 

When auditing is enabled and Robo-FTP encounters a task that could output a file, it queries the auditing database for a record showing that the specific output was already successfully applied to this file. If a task record is found that matches the file's name, size and modification timestamp then the task is skipped. If no record is found, the task is executed and a record recording the task, file stats and result is added to the database. This allows you to avoid problems that might be caused by performing the same task twice.

 

Call the AUDITDB command with a [ file name ] but no options to open an existing SQLite audit database file:

 

AUDITDB "daily_upload.sql"

 

Use the /new option to reset the auditing database to an empty state:

 

AUDITDB "daily_upload.sql" /new

 

Calling this command with no arguments or options will disable auditing:

 

AUDITDB

 

The following commands perform tasks that will be skipped if the auditing database is active and includes a record indicated that the task was previously completed successfully: SENDFILE, RCVFILE, SYNC, COPY, MOVE, APPEND, PGPENCRYPT, PGPDECRYPT, ZIP and UNZIP.

 

Note: If you are sending or receiving with the /localdate or /serverdate option that can change a file's timestamp in a way that may impact auditing.

 

An audited task returns success when it is skipped due to a previous successful completion. This means you can add auditing to existing command scripts without significant changes to the logic. Here is an example of a command that performs a task that was skipped because a record was found in the the audit database that indicated the task had already completed successfully:

 

SENDFILE "readme.txt"

CMD:        SENDFILE "readme.txt"

*Sending file "C:\Program Files (x86)\Robo-FTP 3.8\readme.txt"

*Transaction already complete.

*Upload complete, 1 file sent.

 

The AUDITDB command uses the built-in SQLite database engine by default but the /odbc option allows you to use another type of database engine to audit file transfers. Depending on your project requirements you may prefer to use a high performance external database instead of the built-in SQLite option. See the Help topic for the DBUSE command for details of how to use the /odbc option.

 

Use the TMPNAME and FTPTMPNAME commands together with AUDITDB to take full advantage of Robo-FTP's transactional features.

 

 

Related command(s): TMPNAME, FTPTMPNAME, DBUSE, IFERROR

See also: Fault Tolerant Scripts, Using the built-in database engine, Alternate Default Path