Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8f1462e52e1797a02c97073eed0b7f92 > files > 717

python-docs-2.6.5-2.5mdv2010.2.i586.rpm

<!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>12.12. dumbdbm — Portable DBM implementation &mdash; Python v2.6.5 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:     '2.6.5',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.5 documentation" href="../index.html" />
    <link rel="up" title="12. Data Persistence" href="persistence.html" />
    <link rel="next" title="12.13. sqlite3 — DB-API 2.0 interface for SQLite databases" href="sqlite3.html" />
    <link rel="prev" title="12.11. bsddb — Interface to Berkeley DB library" href="bsddb.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </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="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="sqlite3.html" title="12.13. sqlite3 — DB-API 2.0 interface for SQLite databases"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="bsddb.html" title="12.11. bsddb — Interface to Berkeley DB library"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="persistence.html" accesskey="U">12. Data Persistence</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-dumbdbm">
<h1>12.12. <tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt> &#8212; Portable DBM implementation<a class="headerlink" href="#module-dumbdbm" title="Permalink to this headline">¶</a></h1>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt> module has been renamed to <tt class="xref docutils literal"><span class="pre">dbm.dumb</span></tt> in Python 3.0.
The <a class="reference external" href="../glossary.html#term-to3"><em class="xref">2to3</em></a> tool will automatically adapt imports when converting your
sources to 3.0.</p>
</div>
<div class="admonition note" id="index-276">
<p class="first admonition-title">Note</p>
<p class="last">The <tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt> module is intended as a last resort fallback for the
<a title="Generic interface to DBM-style database modules." class="reference external" href="anydbm.html#module-anydbm"><tt class="xref docutils literal"><span class="pre">anydbm</span></tt></a> module when no more robust module is available. The <tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt>
module is not written for speed and is not nearly as heavily used as the other
database modules.</p>
</div>
<p>The <tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt> module provides a persistent dictionary-like interface which
is written entirely in Python.  Unlike other modules such as <a title="(Unix) GNU's reinterpretation of dbm." class="reference external" href="gdbm.html#module-gdbm"><tt class="xref docutils literal"><span class="pre">gdbm</span></tt></a> and
<a title="Interface to Berkeley DB database library" class="reference external" href="bsddb.html#module-bsddb"><tt class="xref docutils literal"><span class="pre">bsddb</span></tt></a>, no external library is required.  As with other persistent
mappings, the keys and values must always be strings.</p>
<p>The module defines the following:</p>
<dl class="exception">
<dt id="dumbdbm.error">
<em class="property">exception </em><tt class="descclassname">dumbdbm.</tt><tt class="descname">error</tt><a class="headerlink" href="#dumbdbm.error" title="Permalink to this definition">¶</a></dt>
<dd>Raised on dumbdbm-specific errors, such as I/O errors.  <a title="exceptions.KeyError" class="reference external" href="exceptions.html#exceptions.KeyError"><tt class="xref docutils literal"><span class="pre">KeyError</span></tt></a> is
raised for general mapping errors like specifying an incorrect key.</dd></dl>

<dl class="function">
<dt id="dumbdbm.open">
<tt class="descclassname">dumbdbm.</tt><tt class="descname">open</tt><big>(</big><em>filename</em><span class="optional">[</span>, <em>flag</em><span class="optional">[</span>, <em>mode</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#dumbdbm.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Open a dumbdbm database and return a dumbdbm object.  The <em>filename</em> argument is
the basename of the database file (without any specific extensions).  When a
dumbdbm database is created, files with <tt class="docutils literal"><span class="pre">.dat</span></tt> and <tt class="docutils literal"><span class="pre">.dir</span></tt> extensions
are created.</p>
<p>The optional <em>flag</em> argument is currently ignored; the database is always opened
for update, and will be created if it does not exist.</p>
<p>The optional <em>mode</em> argument is the Unix mode of the file, used only when the
database has to be created.  It defaults to octal <tt class="docutils literal"><span class="pre">0666</span></tt> (and will be modified
by the prevailing umask).</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.2: </span>The <em>mode</em> argument was ignored in earlier versions.</p>
</dd></dl>

<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt>Module <a title="Generic interface to DBM-style database modules." class="reference external" href="anydbm.html#module-anydbm"><tt class="xref docutils literal"><span class="pre">anydbm</span></tt></a></dt>
<dd>Generic interface to <tt class="docutils literal"><span class="pre">dbm</span></tt>-style databases.</dd>
<dt>Module <a title="(Unix) The standard &quot;database&quot; interface, based on ndbm." class="reference external" href="dbm.html#module-dbm"><tt class="xref docutils literal"><span class="pre">dbm</span></tt></a></dt>
<dd>Similar interface to the DBM/NDBM library.</dd>
<dt>Module <a title="(Unix) GNU's reinterpretation of dbm." class="reference external" href="gdbm.html#module-gdbm"><tt class="xref docutils literal"><span class="pre">gdbm</span></tt></a></dt>
<dd>Similar interface to the GNU GDBM library.</dd>
<dt>Module <a title="Python object persistence." class="reference external" href="shelve.html#module-shelve"><tt class="xref docutils literal"><span class="pre">shelve</span></tt></a></dt>
<dd>Persistence module which stores non-string data.</dd>
<dt>Module <a title="Guess which DBM-style module created a given database." class="reference external" href="whichdb.html#module-whichdb"><tt class="xref docutils literal"><span class="pre">whichdb</span></tt></a></dt>
<dd>Utility module used to determine the type of an existing database.</dd>
</dl>
</div>
<div class="section" id="dumbdbm-objects">
<span id="id1"></span><h2>12.12.1. Dumbdbm Objects<a class="headerlink" href="#dumbdbm-objects" title="Permalink to this headline">¶</a></h2>
<p>In addition to the methods provided by the <a title="UserDict.DictMixin" class="reference external" href="userdict.html#UserDict.DictMixin"><tt class="xref docutils literal"><span class="pre">UserDict.DictMixin</span></tt></a> class,
<tt class="xref docutils literal"><span class="pre">dumbdbm</span></tt> objects provide the following methods.</p>
<dl class="method">
<dt id="dumbdbm.dumbdbm.sync">
<tt class="descclassname">dumbdbm.</tt><tt class="descname">sync</tt><big>(</big><big>)</big><a class="headerlink" href="#dumbdbm.dumbdbm.sync" title="Permalink to this definition">¶</a></dt>
<dd>Synchronize the on-disk directory and data files.  This method is called by the
<a title="dumbdbm.dumbdbm.sync" class="reference internal" href="#dumbdbm.dumbdbm.sync"><tt class="xref docutils literal"><span class="pre">sync()</span></tt></a> method of <tt class="xref docutils literal"><span class="pre">Shelve</span></tt> objects.</dd></dl>

</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 external" href="#">12.12. <tt class="docutils literal"><span class="pre">dumbdbm</span></tt> &#8212; Portable DBM implementation</a><ul>
<li><a class="reference external" href="#dumbdbm-objects">12.12.1. Dumbdbm Objects</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="bsddb.html"
                                  title="previous chapter">12.11. <tt class="docutils literal docutils literal docutils literal"><span class="pre">bsddb</span></tt> &#8212; Interface to Berkeley DB library</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="sqlite3.html"
                                  title="next chapter">12.13. <tt class="docutils literal docutils literal"><span class="pre">sqlite3</span></tt> &#8212; DB-API 2.0 interface for SQLite databases</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/dumbdbm.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <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="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sqlite3.html" title="12.13. sqlite3 — DB-API 2.0 interface for SQLite databases"
             >next</a> |</li>
        <li class="right" >
          <a href="bsddb.html" title="12.11. bsddb — Interface to Berkeley DB library"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="persistence.html" >12. Data Persistence</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2010, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Mar 19, 2010.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5.
    </div>

  </body>
</html>