Chapter 25. A Hashed Database Library


Applications commonly wish to store some form of binary data in a file. Storing such data for efficient retrieval is tricky and error-prone. There are a number of libraries that provide simple APIs for storing information in files. The dbm library was an early part of Unix systems (and was later reimplemented as ndbm), which led later to the the Berkeley db library and the gdbm library from the GNU Project. All of these libraries provide easy access to files that are set up as hash tables, with a binary key providing access to a binary data region.[1]

[1] The Berkeley db library has been greatly extended, and now includes a B-Tree implementation and full transaction capabilities.

While gdbm and Berkeley db are both widely available on Linux systems, the licenses for each of them make them unsuitable for commercial development.[2] The qdbm library is quite similar to those other choices, but is licensed under the LGPL, making it more attractive to many developers. The basic API for each of these libraries is quite similar to the others, however, and porting code between the libraries is straightforward.

[2] Berkeley db is now developed by a for-profit organization, and they sell alternative licenses for their library that are attractive for certain applications.

Full source code and documentation for qdbm are available from the Web site. This chapter describes all of the functions most applications need to use qdbm (all of which have close analogues in Berkeley db, gdbm, and ndbm). There are other API functions available, all of which are documented at the qdbm Web site.


    Linux Application Development
    Linux Application Development (paperback) (2nd Edition)
    ISBN: 0321563220
    EAN: 2147483647
    Year: 2003
    Pages: 168 © 2008-2017.
    If you may any questions please contact us: