<!--$Id-->
<!--Copyright 1997, 1998, 1999, 2000 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<html>
<head>
<title>Berkeley DB: DbEnv::set_flags</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
</head>
<body bgcolor=white>
        <a name="2"><!--meow--></a>    
<table><tr valign=top>
<td>
<h1>DbEnv::set_flags</h1>
</td>
<td width="1%">
<a href="../api_cxx/cxx_index.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbEnv::set_flags(u_int32_t flags, int onoff);
</pre></h3>
<h1>Description</h1>
<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or more
of the following values.
If <b>onoff</b> is zero, the specified flags are cleared, otherwise they
are set.
<p><dl compact>
<p><dt><a name="DB_CDB_ALLDB">DB_CDB_ALLDB</a><dd>For Berkeley DB Concurrent Data Store applications, perform locking on an environment-wide basis
rather than per-database.  This flag may only be used to configure Berkeley DB
before the <a href="../api_cxx/env_open.html">DbEnv::open</a> interface is called.
<p><dt><a name="DB_NOMMAP">DB_NOMMAP</a><dd>Copy read-only database files in this environment into the local cache
instead of potentially mapping them into process memory (see the
description of the <a href="../api_cxx/env_set_mp_mmapsize.html">DbEnv::set_mp_mmapsize</a> method for further information).
<p><dt><a name="DB_TXN_NOSYNC">DB_TXN_NOSYNC</a><dd>Do not synchronously flush the log on transaction commit or prepare.
This means that transactions exhibit the ACI (atomicity, consistency and
isolation) properties, but not D (durability), i.e., database integrity
will be maintained but it is possible that some number of the most
recently committed transactions may be undone during recovery instead of
being redone.
<p>The number of transactions that are potentially at risk is governed by
how often the log is checkpointed (see <a href="../utility/db_checkpoint.html">db_checkpoint</a> for more
information) and how many log updates can fit on a single log page.
</dl>
<p>The DbEnv::set_flags 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.
<p>The database environment's flag values may also be set using the environment's
<b>DB_CONFIG</b> file.  The syntax of the entry in that file is a
single line with the string "set_flags", one or more whitespace characters,
and the interface flag argument as a string, for example, "set_flags
DB_TXN_NOSYNC".  Because the <b>DB_CONFIG</b> file is read when the database
environment is opened, it will silently overrule configuration done
before that time.
<h1>Errors</h1>
<p><dl compact>
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
</dl>
<h3>Class</h3>
<a href="../api_cxx/dbenv_class.html">DbEnv</a>
<h1>See Also</h1>
<a href="../api_cxx/env_close.html">DbEnv::close</a>,
<a href="../api_cxx/env_open.html">DbEnv::open</a>,
<a href="../api_cxx/env_remove.html">DbEnv::remove</a>,
<a href="../api_cxx/db_err.html">DbEnv::err</a>,
<a href="../api_cxx/env_strerror.html">DbEnv::strerror</a>,
<a href="../api_cxx/env_version.html">DbEnv::version</a>,
<a href="../api_cxx/env_set_cachesize.html">DbEnv::set_cachesize</a>,
<a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a>,
<a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a>,
<a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a>,
<a href="../api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>,
<a href="../api_cxx/env_set_flags.html">DbEnv::set_flags</a>,
<a href="../api_cxx/env_set_mutexlocks.html">DbEnv::set_mutexlocks</a>,
<a href="../api_cxx/env_set_paniccall.html">DbEnv::set_paniccall</a>,
and
<a href="../api_cxx/env_set_verbose.html">DbEnv::set_verbose</a>.
</tt>
<table><tr><td><br></td><td width="1%">
<a href="../api_cxx/cxx_index.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
</body>
</html>