MemCom Reference Manual > MemCom C API Manual Pages > Database Manager Functions > mcDBpack

Name

mcDBpack — Pack (defragment) database

Synopsis

#include <memcom.h>

int mcDBpack(int handle);

Description

mcDBpack packs the database handle. All inactive and/or deleted sets are removed, as well as any empty space. Note that mcDBpack modifies the file offset (also referred to as file address) of the datasets. If no empty space is found mcDBpack does not modify the database.

Parameters

handle

Database handle of open database to be saved (input).

Warning

In the current version of MemCom this function is still in an experimental state, i.e it is not completely safe: If, for some reason (power off, kill process, etc.) mcDBpack cannot terminate, some or all data are lost. If, for the time being, an absolutely safe operation is required, copy the entire file to a new file (note that this method requires up to twice the amount of disk space occupied by the current database).

mcDBpack changes the file addresses of the datasets. Thus,functions which make use of file addresses (like mcDBputStream or mcDBgetStream) must then take into account the modified addresses!