company logo

Client :: packDatabase - Pack database

The function can be called in order to remove unused space from the database. The function packs the database by copying it to a new file. When there is not enough space on the disk, a path referring to a temporary directory might be passed to the packing function. Otherwise the database is packed in the same directory.

The function starts the database backup service. This may run locally but also on a server. Running the function locally, usually a database path (sDatabasePath) and an optional backup target (sTargetPath) are required and should contain the complete path to the file locations.

When the database consists of several main or subbases, each file is packed by creating temporary file.

The function cannot be called from a client in order to pack a server database.

When passing an invalid client handle or when errors are encountered during packing the file, the unpacked database file remains unchanged an the function throws an exception.

Implementation overview

Implementation details

  1. Pack database in same folder
    Client  :: packDatabase ( odaba::String &sFilePath )

    The function creates a copy of the database passed in sFileName in the folder in which the database file is stored. When terminating successful, the old database file is deleted and the new copy is renamed to the original file name. The temporary file created has got the extension .#_0.

    When an error is detected, the new file will be removed.

    • sFilePath - Complete file path
  2. to list
  3. Pack database in different folder
    Client  :: packDatabase ( odaba::String &sFilePath, odaba::String &sTempPath )

    The function creates a copy of the database passed in sFileName in the file passed in sTempPath.When terminating successful, the old database file is deleted and the new copy is moved to the original database file location.

    When an error is detected, the new file will be removed.

    • sFilePath - Complete file path
    • sTempPath - Folder for temporary files

      The path refers to a folder where temporary files can be written.

  4. to list