| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-whichdb.html" /> |
| 13 | <link rel="prev" href="module-anydbm.html" /> |
| 14 | <link rel="parent" href="someos.html" /> |
| 15 | <link rel="next" href="dbhash-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>7.11 dbhash -- DBM-style interface to the BSD database library</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="7.10 anydbm " |
| 25 | href="module-anydbm.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="7. Optional Operating System" |
| 28 | href="someos.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="7.11.1 Database Objects" |
| 31 | href="dbhash-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-anydbm.html">7.10 anydbm </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="dbhash-objects.html">7.11.1 Database Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION0091100000000000000000"> |
| 56 | 7.11 <tt class="module">dbhash</tt> -- |
| 57 | DBM-style interface to the BSD database library</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-dbhash"></A> |
| 62 | <p class="availability">Availability: <span |
| 63 | class="platform">Unix, Windows</span>.</p> |
| 64 | |
| 65 | <P> |
| 66 | The <tt class="module">dbhash</tt> module provides a function to open databases using |
| 67 | the BSD <code>db</code> library. This module mirrors the interface of the |
| 68 | other Python database modules that provide access to DBM-style |
| 69 | databases. The <tt class="module"><a href="module-bsddb.html">bsddb</a></tt><a id='l2h-2788' xml:id='l2h-2788'></a> module is required |
| 70 | to use <tt class="module">dbhash</tt>. |
| 71 | |
| 72 | <P> |
| 73 | This module provides an exception and a function: |
| 74 | |
| 75 | <P> |
| 76 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-2786' xml:id='l2h-2786' class="exception">error</tt></b></dt> |
| 77 | <dd> |
| 78 | Exception raised on database errors other than |
| 79 | <tt class="exception">KeyError</tt>. It is a synonym for <tt class="exception">bsddb.error</tt>. |
| 80 | </dd></dl> |
| 81 | |
| 82 | <P> |
| 83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 84 | <td><nobr><b><tt id='l2h-2787' xml:id='l2h-2787' class="function">open</tt></b>(</nobr></td> |
| 85 | <td><var>path</var><big>[</big><var>, flag</var><big>[</big><var>, mode</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> |
| 86 | <dd> |
| 87 | Open a <code>db</code> database and return the database object. The |
| 88 | <var>path</var> argument is the name of the database file. |
| 89 | |
| 90 | <P> |
| 91 | The <var>flag</var> argument can be |
| 92 | <code>'r'</code> (the default), <code>'w'</code>, |
| 93 | <code>'c'</code> (which creates the database if it doesn't exist), or |
| 94 | <code>'n'</code> (which always creates a new empty database). |
| 95 | For platforms on which the BSD <code>db</code> library supports locking, |
| 96 | an "<tt class="character">l</tt>" can be appended to indicate that locking should be |
| 97 | used. |
| 98 | |
| 99 | <P> |
| 100 | The optional <var>mode</var> parameter is used to indicate the <span class="Unix">Unix</span> |
| 101 | permission bits that should be set if a new database must be |
| 102 | created; this will be masked by the current umask value for the |
| 103 | process. |
| 104 | </dl> |
| 105 | |
| 106 | <P> |
| 107 | <div class="seealso"> |
| 108 | <p class="heading">See Also:</p> |
| 109 | |
| 110 | <dl compact="compact" class="seemodule"> |
| 111 | <dt>Module <b><tt class="module"><a href="module-anydbm.html">anydbm</a></tt>:</b> |
| 112 | <dd>Generic interface to <code>dbm</code>-style databases. |
| 113 | </dl> |
| 114 | <dl compact="compact" class="seemodule"> |
| 115 | <dt>Module <b><tt class="module"><a href="module-bsddb.html">bsddb</a></tt>:</b> |
| 116 | <dd>Lower-level interface to the BSD <code>db</code> library. |
| 117 | </dl> |
| 118 | <dl compact="compact" class="seemodule"> |
| 119 | <dt>Module <b><tt class="module"><a href="module-whichdb.html">whichdb</a></tt>:</b> |
| 120 | <dd>Utility module used to determine the type of an |
| 121 | existing database. |
| 122 | </dl> |
| 123 | </div> |
| 124 | |
| 125 | <P> |
| 126 | |
| 127 | <p><br /></p><hr class='online-navigation' /> |
| 128 | <div class='online-navigation'> |
| 129 | <!--Table of Child-Links--> |
| 130 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 131 | |
| 132 | <UL CLASS="ChildLinks"> |
| 133 | <LI><A href="dbhash-objects.html">7.11.1 Database Objects</a> |
| 134 | </ul> |
| 135 | <!--End of Table of Child-Links--> |
| 136 | </div> |
| 137 | |
| 138 | <DIV CLASS="navigation"> |
| 139 | <div class='online-navigation'> |
| 140 | <p></p><hr /> |
| 141 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 142 | <tr> |
| 143 | <td class='online-navigation'><a rel="prev" title="7.10 anydbm " |
| 144 | href="module-anydbm.html"><img src='../icons/previous.png' |
| 145 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 146 | <td class='online-navigation'><a rel="parent" title="7. Optional Operating System" |
| 147 | href="someos.html"><img src='../icons/up.png' |
| 148 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 149 | <td class='online-navigation'><a rel="next" title="7.11.1 Database Objects" |
| 150 | href="dbhash-objects.html"><img src='../icons/next.png' |
| 151 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 152 | <td align="center" width="100%">Python Library Reference</td> |
| 153 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 154 | href="contents.html"><img src='../icons/contents.png' |
| 155 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 156 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 157 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 158 | <td class='online-navigation'><a rel="index" title="Index" |
| 159 | href="genindex.html"><img src='../icons/index.png' |
| 160 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 161 | </tr></table> |
| 162 | <div class='online-navigation'> |
| 163 | <b class="navlabel">Previous:</b> |
| 164 | <a class="sectref" rel="prev" href="module-anydbm.html">7.10 anydbm </A> |
| 165 | <b class="navlabel">Up:</b> |
| 166 | <a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A> |
| 167 | <b class="navlabel">Next:</b> |
| 168 | <a class="sectref" rel="next" href="dbhash-objects.html">7.11.1 Database Objects</A> |
| 169 | </div> |
| 170 | </div> |
| 171 | <hr /> |
| 172 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 173 | </DIV> |
| 174 | <!--End of Navigation Panel--> |
| 175 | <ADDRESS> |
| 176 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 177 | </ADDRESS> |
| 178 | </BODY> |
| 179 | </HTML> |