Go to the previous, next section.

Database Synchronization

If your database was opened with the GDBM_FAST flag, gdbm does not wait for writes to the disk to complete before continuing. This allows faster writing of databases at the risk of having a corrupted database if the application terminates in an abnormal fashion. The following function allows the programmer to make sure the disk version of the database has been completely updated with all changes to the current time.

gdbm_sync(dbf);

The parameter is:

GDBM_FILE dbf
The pointer returned by gdbm_open.

This would usually be called after a complete set of changes have been made to the database and before some long waiting time. gdbm_close automatically calls the equivalent of gdbm_sync so no call is needed if the database is to be closed immediately after the set of changes have been made.

Go to the previous, next section.