manpagez: man pages & more
info gdbm
Home | html | info | man

File: gdbm.info,  Node: Database format,  Next: Flat files,  Prev: Sync,  Up: Top

12 Changing database format
***************************

As of version 1.24, 'GDBM' supports databases in two formats: "standard"
and "extended".  The standard format is used most often.  The "extended"
database format is used to provide additional crash resistance (*note
Crash Tolerance::).

   Depending on the value of the FLAGS parameter in a call to
'gdbm_open' (*note GDBM_NUMSYNC: Open.), a database can be created in
either format.

   The format of an existing database can be changed using the
'gdbm_convert' function:

 -- gdbm interface: int gdbm_convert (GDBM_FILE DBF, int FLAG)
     Changes the format of the database file DBF.  Allowed values for
     FLAG are:

     '0'
          Convert database to the standard format.

     'GDBM_NUMSYNC'
          Convert database to the extended "numsync" format (*note
          Numsync::).

     On success, the function returns 0.  In this case, it should be
     followed by a call to 'gdbm_sync' (*note Sync::) or 'gdbm_close'
     (*note Close::) to ensure the changes are written to the disk.

     On error, returns -1 and sets the 'gdbm_errno' variable (*note
     gdbm_errno: Variables.).

     If the database is already in the requested format, the function
     returns success (0) without doing anything.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.