/usr/share/doc/python-bsddb3/html/introduction.html is in python-bsddb3-doc 6.1.0-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Berkeley DB 4.3 thru 6.0 Python Extension Package — PyBSDDB 6.0.0 documentation</title>
<link rel="stylesheet" href="static/default.css" type="text/css" />
<link rel="stylesheet" href="static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '6.0.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="static/jquery.js"></script>
<script type="text/javascript" src="static/underscore.js"></script>
<script type="text/javascript" src="static/doctools.js"></script>
<link rel="top" title="PyBSDDB 6.0.0 documentation" href="index.html" />
<link rel="next" title="DBEnv" href="dbenv.html" />
<link rel="prev" title="Python Bindings for Berkeley DB 4.3 thru 6.0" href="contents.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="dbenv.html" title="DBEnv"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="contents.html" title="Python Bindings for Berkeley DB 4.3 thru 6.0"
accesskey="P">previous</a> |</li>
<li><a href="contents.html">PyBSDDB 6.0.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="berkeley-db-4-3-thru-6-0-python-extension-package">
<h1>Berkeley DB 4.3 thru 6.0 Python Extension Package<a class="headerlink" href="#berkeley-db-4-3-thru-6-0-python-extension-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>This is a simple bit of documentation for the bsddb3.db Python extension
module which wraps the Berkeley DB 4.3 thru 6.0 C library. The extension
module is located in a Python package along with a few pure python
modules.</p>
<p>It is expected that this module will be used in the following general
ways by different programmers in different situations. The goals of
this module are to allow all of these methods without making things too
complex for the simple cases, and without leaving out funtionality
needed by the complex cases.</p>
<ol class="arabic simple">
<li><strong>Backwards compatibility:</strong> It is desirable for this package to be a
near drop-in replacement for the bsddb module shipped with Python
which is designed to wrap either DB 1.85, or the 1.85 compatibility
interface. This means that there will need to be equivalent object
creation functions available, (btopen(), hashopen(), and rnopen())
and the objects returned will need to have the same or at least
similar methods available, (specifically, first(), last(), next(),
and prev() will need to be available without the user needing to
explicitly use a cursor.) All of these have been implemented in
Python code in the bsddb3.__init__.py module.</li>
<li><strong>Simple persistent dictionary:</strong> One small step beyond the above.
The programmer may be aware of and use the new DB object type
directly, but only needs it from a single process and thread. The
programmer should not have to be bothered with using a DBEnv, and the
DB object should behave as much like a dictionary as possible.</li>
<li><strong>Concurrent access dictionaries:</strong> This refers to the ability to
simultaneously have one writer and multiple readers of a DB (either
in multiple threads or processes) and is implemented simply by
creating a DBEnv with certain flags. No extra work is required to
allow this access mode in bsddb3.</li>
<li><strong>Advanced transactional data store:</strong> This mode of use is where the
full capabilities of the Berkeley DB library are called into action.
The programmer will probably not use the dictionary access methods as
much as the regular methods of the DB object, so he can pass
transaction objects to the methods. Again, most of this advanced
functionality is activated simply by opening a DBEnv with the proper
flags, and also by using transactions and being aware of and reacting
to deadlock exceptions, etc.</li>
</ol>
</div>
<div class="section" id="types-provided">
<h2>Types Provided<a class="headerlink" href="#types-provided" title="Permalink to this headline">¶</a></h2>
<p>The bsddb3.db extension module provides the following object types:</p>
<ul class="simple">
<li><strong>DB:</strong> The basic database object, capable of Hash, BTree, Recno, and
Queue access methods.</li>
<li><strong>DBEnv:</strong> Provides a Database Environment for more advanced database
use. Apps using transactions, logging, concurrent access, etc. will
need to have an environment object.</li>
<li><strong>DBCursor:</strong> A pointer-like object used to traverse a database.</li>
<li><strong>DBTxn:</strong> A database transaction. Allows for multi-file commit, abort
and checkpoint of database modifications.</li>
<li><strong>DBLock:</strong> An opaque handle for a lock. See DBEnv.lock_get() and
DBEnv.lock_put(). Locks are not necessarily associated with anything
in the database, but can be used for any syncronization task across
all threads and processes that have the DBEnv open.</li>
<li><strong>DBSequence:</strong> Sequences provide an arbitrary number of persistent
objects that return an increasing or decreasing sequence of integers.
Opening a sequence handle associates it with a record in a database.</li>
<li><strong>DBSite:</strong> Site object for Replication Manager.</li>
</ul>
</div>
<div class="section" id="top-level-functions">
<h2>Top level functions<a class="headerlink" href="#top-level-functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="version">
<tt class="descname">version</tt><big>(</big><big>)</big><a class="headerlink" href="#version" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple with major, minor and patch level.
<a class="reference external" href="http://docs.oracle.com/cd/E17076_03/html/api_reference/C/envversion.html">More info...</a></p>
</dd></dl>
<dl class="function">
<dt id="full_version">
<tt class="descname">full_version</tt><big>(</big><big>)</big><a class="headerlink" href="#full_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple with the full version string, family, release,
major, minor and patch level.
<a class="reference external" href="http://docs.oracle.com/cd/E17076_03/html/api_reference/C/envfullversion.html">More info...</a></p>
</dd></dl>
</div>
<div class="section" id="exceptions-provided">
<h2>Exceptions Provided<a class="headerlink" href="#exceptions-provided" title="Permalink to this headline">¶</a></h2>
<p>The Berkeley DB C API uses function return codes to signal various
errors. The bsddb3.db module checks for these error codes and turns them
into Python exceptions, allowing you to use familiar try:... except:...
constructs and not have to bother with checking every method’s return
value.</p>
<p>Each of the error codes is turned into an exception specific to that
error code, as outlined in the table below. If you are using the C API
documentation then it is very easy to map the error return codes
specified there to the name of the Python exception that will be raised.
Simply refer to the table below.</p>
<p>Each exception derives from the DBError exception class so if you just
want to catch generic errors you can use DBError to do it. Since
DBNotFoundError is raised when a given key is not found in the database,
DBNotFoundError also derives from the standard KeyError exception to
help make a DB look and act like a dictionary. We do the same trick with
DBKeyEmptyError.</p>
<p>When any of these exceptions is raised, the associated value is a tuple
containing an integer representing the error code and a string for the
error message itself.</p>
<blockquote>
<div><table border="1" class="docutils">
<colgroup>
<col width="39%" />
<col width="61%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><strong>DBError</strong></td>
<td>Base class, all others derive from this</td>
</tr>
<tr class="row-even"><td><strong>DBCursorClosedError</strong></td>
<td>When trying to use a closed cursor</td>
</tr>
<tr class="row-odd"><td><strong>DBForeignConflictError</strong></td>
<td>DB_FOREIGN_CONFLICT</td>
</tr>
<tr class="row-even"><td><strong>DBKeyEmptyError</strong></td>
<td>DB_KEYEMPTY (also derives from KeyError)</td>
</tr>
<tr class="row-odd"><td><strong>DBKeyExistError</strong></td>
<td>DB_KEYEXIST</td>
</tr>
<tr class="row-even"><td><strong>DBLockDeadlockError</strong></td>
<td>DB_LOCK_DEADLOCK</td>
</tr>
<tr class="row-odd"><td><strong>DBLockNotGrantedError</strong></td>
<td>DB_LOCK_NOTGRANTED</td>
</tr>
<tr class="row-even"><td><strong>DBNotFoundError</strong></td>
<td>DB_NOTFOUND (also derives from KeyError)</td>
</tr>
<tr class="row-odd"><td><strong>DBOldVersionError</strong></td>
<td>DB_OLD_VERSION</td>
</tr>
<tr class="row-even"><td><strong>DBPageNotFoundError</strong></td>
<td>DB_PAGE_NOTFOUND</td>
</tr>
<tr class="row-odd"><td><strong>DBRepHandleDeadError</strong></td>
<td>DB_REP_HANDLE_DEAD</td>
</tr>
<tr class="row-even"><td><strong>DBRepLeaseExpiredError</strong></td>
<td>DB_REP_LEASE_EXPIRED</td>
</tr>
<tr class="row-odd"><td><strong>DBRepLockoutError</strong></td>
<td>DB_REP_LOCKOUT</td>
</tr>
<tr class="row-even"><td><strong>DBRepUnavailError</strong></td>
<td>DB_REP_UNAVAIL</td>
</tr>
<tr class="row-odd"><td><strong>DBRunRecoveryError</strong></td>
<td>DB_RUNRECOVERY</td>
</tr>
<tr class="row-even"><td><strong>DBSecondaryBadError</strong></td>
<td>DB_SECONDARY_BAD</td>
</tr>
<tr class="row-odd"><td><strong>DBVerifyBadError</strong></td>
<td>DB_VERIFY_BAD</td>
</tr>
<tr class="row-even"><td><strong>DBNoServerError</strong></td>
<td>DB_NOSERVER</td>
</tr>
<tr class="row-odd"><td><strong>DBNoServerHomeError</strong></td>
<td>DB_NOSERVER_HOME</td>
</tr>
<tr class="row-even"><td><strong>DBNoServerIDError</strong></td>
<td>DB_NOSERVER_ID</td>
</tr>
<tr class="row-odd"><td><strong>DBInvalidArgError</strong></td>
<td>EINVAL</td>
</tr>
<tr class="row-even"><td><strong>DBAccessError</strong></td>
<td>EACCES</td>
</tr>
<tr class="row-odd"><td><strong>DBNoSpaceError</strong></td>
<td>ENOSPC</td>
</tr>
<tr class="row-even"><td><strong>DBNoMemoryError</strong></td>
<td>DB_BUFFER_SMALL</td>
</tr>
<tr class="row-odd"><td><strong>DBAgainError</strong></td>
<td>EAGAIN</td>
</tr>
<tr class="row-even"><td><strong>DBBusyError</strong></td>
<td>EBUSY</td>
</tr>
<tr class="row-odd"><td><strong>DBFileExistsError</strong></td>
<td>EEXIST</td>
</tr>
<tr class="row-even"><td><strong>DBNoSuchFileError</strong></td>
<td>ENOENT</td>
</tr>
<tr class="row-odd"><td><strong>DBPermissionsError</strong></td>
<td>EPERM</td>
</tr>
</tbody>
</table>
</div></blockquote>
</div>
<div class="section" id="other-package-modules">
<h2>Other Package Modules<a class="headerlink" href="#other-package-modules" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><strong>dbshelve.py:</strong> This is an implementation of the standard Python
shelve concept for storing objects that uses bsddb3 specifically, and
also exposes some of the more advanced methods and capabilities of the
underlying DB.</li>
<li><strong>dbtables.py:</strong> This is a module by Gregory Smith that implements a
simplistic table structure on top of a DB.</li>
<li><strong>dbutils.py:</strong> A catch-all for python code that is generally useful
when working with DB’s</li>
<li><strong>dbobj.py:</strong> Contains subclassable versions of DB and DBEnv.</li>
<li><strong>dbrecio.py:</strong> Contains the DBRecIO class that can be used to do
partial reads and writes from a DB record using a file-like interface.
Contributed by Itamar Shtull-Trauring.</li>
</ul>
</div>
<div class="section" id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
<p>A full unit test suite is being developed to exercise the various object
types, their methods and the various usage modes described in the
introduction. <a class="reference external" href="http://pyunit.sourceforge.net/">PyUnit</a> is used and
the tests are structured such that they can be run unattended and
automated. There are currently 482 test cases! (March 2010)</p>
</div>
<div class="section" id="reference">
<h2>Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h2>
<p>See the C language API <a class="reference external" href="http://docs.oracle.com/cd/E17076_03/html/api_reference/C/index.html">online documentation</a>
on Oracle’s website for more details of the
functionality of each of these methods. The names of all the Python
methods should be the same or similar to the names in the C API.</p>
<p>Berkeley DB is very powerful and versatile, but it is complex to
use correctly. <a class="reference external" href="http://docs.oracle.com/cd/E17076_03/html/toc.htm">Oracle documentation</a> is very
complete. Please, review it.</p>
<p><strong>NOTE:</strong> All the methods shown below having more than one keyword
argument are actually implemented using keyword argument parsing, so you
can use keywords to provide optional parameters as desired. Those that
have only a single optional argument are implemented without keyword
parsing to help keep the implementation simple. If this is too confusing
let me know and I’ll think about using keywords for everything.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Berkeley DB 4.3 thru 6.0 Python Extension Package</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#types-provided">Types Provided</a></li>
<li><a class="reference internal" href="#top-level-functions">Top level functions</a></li>
<li><a class="reference internal" href="#exceptions-provided">Exceptions Provided</a></li>
<li><a class="reference internal" href="#other-package-modules">Other Package Modules</a></li>
<li><a class="reference internal" href="#testing">Testing</a></li>
<li><a class="reference internal" href="#reference">Reference</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="contents.html"
title="previous chapter">Python Bindings for Berkeley DB 4.3 thru 6.0</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="dbenv.html"
title="next chapter">DBEnv</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="dbenv.html" title="DBEnv"
>next</a> |</li>
<li class="right" >
<a href="contents.html" title="Python Bindings for Berkeley DB 4.3 thru 6.0"
>previous</a> |</li>
<li><a href="contents.html">PyBSDDB 6.0.0 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008-2013 Jesus Cea Avion.
Last updated on Dec 04, 2013.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|