TurboDB VCL Component Library

TTdbDatabase.Compress

TTdbDatabase

Previous  Top  Next

Reduces the file size of a single-file database to the minimum.

Delphi syntax:

procedure Compress;

C++ Syntax:

void __fastcall Compress(void);

Description

A single-file database reuses the space gained from the deletion of records for new records, but it does not free this space. Therefore the file size of a single-file database is not reduced, even if all records of all tables are deleted. While this behavior is the best for optimal performance, it is sometimes not desired, e.g. for deployment of the database. Calling Compress frees this unused disk space.

You must make sure that there is absolutely no other access to the database, when you call Compress. The safes way to reach this is to close the database and reopen it in exclusive mode.

The method has no effect on a directory database.