n | |
| :mod:`dbhash` --- DBM-style interface to the BSD database library |
| ================================================================= |
| |
| .. module:: dbhash |
n | :platform: Unix, Windows |
| :synopsis: DBM-style interface to the BSD database library. |
| .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org> |
| |
n | .. deprecated:: 2.6 |
| The :mod:`dbhash` module has been deprecated for removal in Python 3.0. |
| |
| .. index:: module: bsddb |
| |
| The :mod:`dbhash` module provides a function to open databases using the BSD |
| ``db`` library. This module mirrors the interface of the other Python database |
| modules that provide access to DBM-style databases. The :mod:`bsddb` module is |
| required to use :mod:`dbhash`. |
| |
| for :exc:`bsddb.error`. |
| |
| |
| .. function:: open(path[, flag[, mode]]) |
| |
| Open a ``db`` database and return the database object. The *path* argument is |
| the name of the database file. |
| |
t | The *flag* argument can be ``'r'`` (the default), ``'w'``, ``'c'`` (which |
t | The *flag* argument can be: |
| creates the database if it doesn't exist), or ``'n'`` (which always creates a |
| |
| new empty database). For platforms on which the BSD ``db`` library supports |
| +---------+-------------------------------------------+ |
| | Value | Meaning | |
| +=========+===========================================+ |
| | ``'r'`` | Open existing database for reading only | |
| | | (default) | |
| +---------+-------------------------------------------+ |
| | ``'w'`` | Open existing database for reading and | |
| | | writing | |
| +---------+-------------------------------------------+ |
| | ``'c'`` | Open database for reading and writing, | |
| | | creating it if it doesn't exist | |
| +---------+-------------------------------------------+ |
| | ``'n'`` | Always create a new, empty database, open | |
| | | for reading and writing | |
| +---------+-------------------------------------------+ |
| |
| For platforms on which the BSD ``db`` library supports locking, an ``'l'`` |
| locking, an ``'l'`` can be appended to indicate that locking should be used. |
| can be appended to indicate that locking should be used. |
| |
| The optional *mode* parameter is used to indicate the Unix permission bits that |
| should be set if a new database must be created; this will be masked by the |
| current umask value for the process. |
| |
| |
| .. seealso:: |
| |