compactFile

compactFile(): Integer;

The compactFile method of the DbFile class initiates a compaction of the physical database file. This method returns the number of errors that were detected when compacting the database file.

The compactFile method executes on a persistent server node, and is implemented and executed by the physical database engine.

A database file can be compacted while permitting concurrent transactions to update the file. Moreover, the compaction operation can be aborted without losing updates made by committed transactions.

The following example shows the use of the compactFile method.

onlineCompact();
vars
    dba : JadeDatabaseAdmin;
    dbFile : DbFile;
    dbfiles : DbFileArray;
begin
    create dba;
    create dbfiles transient;
    dba.getDbFiles(DbFile.Kind_User_Data, dbfiles);
    foreach dbFile in dbfiles do
        dbFile.compactFile;
    endforeach;
epilog
    delete dba;
    delete dbfiles;
end;

For details, see "Compacting Files", in Chapter 3 of the JADE Database Administration Guide.