Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > main-release > by-pkgid > a00abf5f94bf470fd4cc9e10b2d135e0 > files > 637

lib64db4.8-devel-4.8.26-1mdv2010.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>DbMpoolFile::open()</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
    <link rel="up" href="memp.html" title="Chapter 9.  The DbMpoolFile Handle" />
    <link rel="prev" href="mempfget.html" title="DbMpoolFile::get()" />
    <link rel="next" href="mempput.html" title="DbMpoolFile::put()" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">DbMpoolFile::open()</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="mempfget.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 9. 
              The  DbMpoolFile Handle
        </th>
          <td width="20%" align="right"> <a accesskey="n" href="mempput.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="mempfopen"></a>DbMpoolFile::open()</h2>
          </div>
        </div>
      </div>
      <pre class="programlisting">#include &lt;db_cxx.h&gt;
 
int
DbMpoolFile::open(const char *file, u_int32_t flags, int mode, size_t pagesize);</pre>
      <p>
         The <code class="methodname">DbMpoolFile::open()</code> method opens a file in the in-memory cache. 
    </p>
      <p>
         The <code class="methodname">DbMpoolFile::open()</code> <span>
            
            <span>
                method either returns a non-zero error value or throws an
                exception that encapsulates a non-zero error value on
                failure, and returns 0 on success.
            </span>
        </span>
    </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1693849"></a>Parameters</h3>
            </div>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1694463"></a>file</h4>
              </div>
            </div>
          </div>
          <p>
                          The <span class="bold"><strong>file</strong></span> parameter is the name of the
                          file to be opened.  If <span class="bold"><strong>file</strong></span> is NULL,
                          a private temporary file is created that cannot be shared with any
                          other process (although it may be shared with other threads of control
                          in the same process).
                     </p>
          <p>
                         When using a Unicode build on Windows (the default), the 
                         <span class="bold"><strong>file</strong></span> argument will
                         be interpreted as a UTF-8 string, which is equivalent to ASCII for Latin
                         characters.
                     </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1694689"></a>flags</h4>
              </div>
            </div>
          </div>
          <p>
                        The <span class="bold"><strong>flags</strong></span> parameter must be set to zero or
                        by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together one
                        or more of the following values: 
                </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p><a id="mempopen_DB_CREATE"></a>
                                     <code class="literal">DB_CREATE</code>
                                </p>
                <p>
                                        Create any underlying files, as necessary. If the database do not already exist
                                        and the <code class="literal">DB_CREATE</code> flag is not specified, the 
                                        call will fail.
                                </p>
              </li>
              <li>
                <p><a id="mempopen_DB_EXCL"></a>
                                     <code class="literal">DB_DIRECT</code>
                                </p>
                <p>
                                        If set and supported by the system, turn off system buffering of the file to
                                        avoid double caching.
                                </p>
              </li>
              <li>
                <p><a id="mempopen_DB_MULTIVERSION"></a>
                                     <code class="literal">DB_MULTIVERSION</code>
                                </p>
                <p>
                                        Open the file with support for 
                                        <a href="../../programmer_reference/transapp_read.html" class="olink">multiversion concurrency control</a>. 
                                        Calls to <a class="xref" href="mempfget.html" title="DbMpoolFile::get()">DbMpoolFile::get()</a>
                                        with dirty pages will cause copies to be made in the cache.
                                </p>
              </li>
              <li>
                <p><a id="mempopen_DB_NOMMAP"></a>
                                     <code class="literal">DB_NOMMAP</code>
                                </p>
                <p>
                                        Always copy this file into the local cache instead of potentially mapping it
                                        into process memory (see the
                                        <a class="xref" href="envset_mp_mmapsize.html" title="DbEnv::set_mp_mmapsize()">DbEnv::set_mp_mmapsize()</a>  
                                        method for further information).
                                </p>
              </li>
              <li>
                <p><a id="mempopen_DB_ODDFILESIZE"></a>
                                         <code class="literal">DB_ODDFILESIZE</code>
                                </p>
                <p>
                                        Attempts to open files which are not a multiple of the page size in length will
                                        fail, by default. If the DB_ODDFILESIZE flag is set, any partial page at the end
                                        of the file will be ignored and the open will proceed.
                                </p>
              </li>
              <li>
                <p><a id="mempopen_DB_RDONLY"></a>
                                         <code class="literal">DB_RDONLY</code>
                                </p>
                <p>
                                        Open any underlying files for reading only. Any attempt to modify
                                        the file using the memory pool (cache) functions will fail, regardless of the actual
                                        permissions of the file.
                                </p>
              </li>
            </ul>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1694888"></a>mode</h4>
              </div>
            </div>
          </div>
          <p>
                          On Windows systems, the mode parameter is ignored.                    
                     </p>
          <p>
                        On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files
                        created by <code class="methodname">DbMpoolFile::open()</code> are created with mode
                        <span class="bold"><strong>mode</strong></span> (as described in <span class="bold"><strong>chmod</strong></span>(2)) and modified by the process' umask
                        value at the time of creation (see <span class="bold"><strong>umask</strong></span>(2)).  Created files are owned by the
                        process owner; the group ownership of created files is based on the system
                        and directory defaults, and is not further specified by Berkeley DB.  System
                        shared memory segments created by <code class="methodname">DbMpoolFile::open()</code> are
                        created with mode <span class="bold"><strong>mode</strong></span>, unmodified by the
                        process' umask value.  If <span class="bold"><strong>mode</strong></span> is 0,
                        <code class="methodname">DbMpoolFile::open()</code> will use a default mode of readable
                        and writable by both owner and group.
                     </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1694924"></a>pagesize</h4>
              </div>
            </div>
          </div>
          <p>
                          The <span class="bold"><strong>pagesize</strong></span> parameter is the size,
                          in bytes, of the unit of transfer between the application and the
                          cache, although it is not necessarily the unit of transfer between the
                          cache and the underlying filesystem.
                     </p>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1694904"></a>Errors</h3>
            </div>
          </div>
        </div>
        <p>
                         The <code class="methodname">DbMpoolFile::open()</code> <span>
            
            <span>
                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
                exception, encapsulating one of the following non-zero errors, or return one
                of the following non-zero errors:
            </span>
        </span>
                    </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1694748"></a>EINVAL</h4>
              </div>
            </div>
          </div>
          <p>
                              If the file has already been entered into the cache, and the <span class="bold"><strong>pagesize</strong></span> value is not the same as when the file
                              was entered into the cache, or the length of the file is not zero or a
                              multiple of the <span class="bold"><strong>pagesize</strong></span>; the
                              DB_RDONLY flag was specified for an in-memory cache; or if an invalid
                              flag value or parameter was specified.
                         </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1695258"></a>ENOMEM</h4>
              </div>
            </div>
          </div>
          <p>
                              The maximum number of open files has been reached.
                         </p>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1694596"></a>Class</h3>
            </div>
          </div>
        </div>
        <p>
                 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, <a class="link" href="memp.html" title="Chapter 9.  The DbMpoolFile Handle">DbMpoolFile</a> 
            </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1694691"></a>See Also</h3>
            </div>
          </div>
        </div>
        <p>
                     <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a> 
                </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="mempfget.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="memp.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="mempput.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">DbMpoolFile::get() </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> DbMpoolFile::put()</td>
        </tr>
      </table>
    </div>
  </body>
</html>