Definition: | integer i = db_compress() |
Description: | Compress the current database. The current database is copied to a new file such that any blocks of unused space are eliminated. If successful, i will be set to DB_OK(0), and the new compressed database file will retain the same name. As a backup, the original, uncompressed file will be renamed with an extension of .t0 (or .t1, .t2 ,..., .t99). If the compression is unsuccessful, the database will be left unchanged and no backup will be made. |
Comments: | When you delete items from a database, you create blocks of free
space within the database file. The system keeps track of these blocks and
tries to use them for storing new data that you insert. db_compress() will
copy the
current database without copying these free areas. The size of the
database file may therefore be reduced.
If the backup filenames reach .t99 you will have to delete some of them. |
Example: |
if db_compress() != DB_OK then puts(2, "compress failed!\n") end if |
See Also: | db_create |