gecko-dev/db/man/man.html/Db.html

764 строки
38 KiB
HTML

<HTML>
<HEAD>
<TITLE>Db</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<H1>Db</H1>
<HR SIZE=1 NOSHADE>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
<B>#include</B> <B>&lt;db</B>_<B>cxx.h&gt;</B>
<B>static</B> <B>int</B>
<B>Db::open(const</B> <B>char</B> <B>*fname,</B> <B>DBTYPE</B> <B>type,</B>
<B>u</B>_<B>int32</B>_<B>t</B> <B>flags,</B> <B>int</B> <B>mode,</B> <B>DbEnv</B> <B>*dbenv,</B> <B>DbInfo</B> <B>*dbinfo,</B> <B>Db</B> <B>**dbpp);</B>
<B>DBTYPE</B>
<B>Db::get</B>_<B>type(void)</B> <B>const;</B>
<B>int</B>
<B>Db::close(u</B>_<B>int32</B>_<B>t</B> <B>flags);</B>
<B>int</B>
<B>Db::cursor(DbTxn</B> <B>*txnid,</B> <B>Dbc</B> <B>**cursorp);</B>
<B>int</B>
<B>Db::del(Dbt</B> <B>*key,</B> <B>DbTxn</B> <B>*txnid);</B>
<B>int</B>
<B>Db::fd(int</B> <B>*fdp);</B>
<B>int</B>
<B>Db::get(DbTxn</B> <B>*txnid,</B> <B>Dbt</B> <B>*key,</B> <B>Dbt</B> <B>*data,</B> <B>u</B>_<B>int32</B>_<B>t</B> <B>flags);</B>
<B>int</B>
<B>Db::put(DbTxn</B> <B>*txnid,</B> <B>Dbt</B> <B>*key,</B> <B>Dbt</B> <B>*data,</B> <B>u</B>_<B>int32</B>_<B>t</B> <B>flags);</B>
<B>int</B>
<B>Db::stat(void</B> <B>*sp,</B> <B>void</B> <B>*(*db</B>_<B>malloc)(size</B>_<B>t),</B> <B>u</B>_<B>int32</B>_<B>t</B> <B>flags);</B>
<B>int</B>
<B>Db::sync(u</B>_<B>int32</B>_<B>t</B> <B>flags);</B>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The DB library is a family of classes that provides a
modular programming interface to transactions and record-
oriented file access. The library includes support for
transactions, locking, logging and file page caching, as
well as various indexed access methods. Many of the
classes (e.g., the file page caching class) are useful
independent of the other DB classes, although some classes
are explicitly based on other classes (e.g., transactions
and logging). For a general description of the DB
package, see <B><A HREF="db_intro.html">db_intro(3)</A></B>.
This manual page describes the Db class, which is the
center of access activity.
The currently supported file formats are btree, hashed and
recno. The btree format is a representation of a sorted,
balanced tree structure. The hashed format is an
extensible, dynamic hashing scheme. The recno format
supports fixed or variable length records (optionally
retrieved from a flat text file).
Storage and retrieval for the Db access methods are based
on key/data pairs, using the Dbt class. See <B><A HREF="Dbt.html">Dbt(3)</A></B> for
specific information on the structure and capabilities of
a Dbt.
The Db::open method opens the database represented by file
for both reading and writing. Files never intended to be
shared or preserved on disk may be created by setting the
file parameter to NULL.
The Db::open method copies a pointer to a Db object into
the memory location referenced by dbpp. The methods of
this object allow you to perform various database actions,
as described below. The Db::open method throws a
<B><A HREF="DbException.html">DbException(3)</A></B> or returns the value of errno on failure
and 0 on success.
Note, while most of the access methods use file as the
name of an underlying file on disk, this is not
guaranteed. Also, calling Db::open is a reasonably
expensive operation. (This is based on a model where the
DBMS keeps a set of files open for a long time rather than
opening and closing them on each query.)
The type argument is of type DBTYPE (as defined in the
&lt;db_cxx.h&gt; include file) and must be set to one of
DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNOWN. If type is
DB_UNKNOWN, the database must already exist and Db::open
will then determine if it is of type DB_BTREE, DB_HASH or
DB_RECNO.
The flags and mode arguments specify how files will be
opened and/or created when they don't already exist. The
flags value is specified by <B>or</B>'ing together one or more of
the following values:
DB_CREATE
Create any underlying files, as necessary. If the
files do not already exist and the DB_CREATE flag is
not specified, the call will fail.
DB_NOMMAP
Do not map this file (see <B><A HREF="DbMpool.html">DbMpool(3)</A></B> for further
information).
DB_RDONLY
Open the database for reading only. Any attempt to
write the database using the access methods will fail
regardless of the actual permissions of any
underlying files.
DB_THREAD
Cause the Db handle returned by the Db::open method
to be useable by multiple threads within a single
address space, i.e., to be ``free-threaded''.
DB_TRUNCATE
``Truncate'' the database if it exists, i.e., behave
as if the database were just created, discarding any
previous contents.
All files created by the access methods are created with
mode mode (as described in <B>chmod(2)</B>) and modified by the
process' umask value at the time of creation (see
<B>umask(2)</B>). The group ownership of created files is based
on the system and directory defaults, and is not further
specified by DB.
See <B><A HREF="DbEnv.html">DbEnv(3)</A></B> for a description of the dbenv argument, and
<B><A HREF="DbInfo.html">DbInfo(3)</A></B> for a description of the dbinfo argument.
</PRE>
<H2>Db OPERATIONS</H2><PRE>
The Db object returned by Db::open describes a database
type, and includes a set of functions to perform various
actions, as described below. The methods for Db are as
follows:
DBTYPE Db::get_type(void);
The type of the underlying access method (and file
format). Returns one of DB_BTREE, DB_HASH or
DB_RECNO. This value may be used to determine the
type of the database after a return from Db::open
with the type argument set to DB_UNKNOWN.
int Db::close(u_int32_t flags);
A method to flush any cached information to disk,
close any open cursors (see <B><A HREF="Dbc.html">Dbc(3)</A></B>), free any
allocated resources, and close any underlying files.
Since key/data pairs are cached in memory, failing to
sync the file with the close or sync method may
result in inconsistent or lost information.
The flags parameter must be set to 0 or the following
value:
DB_NOSYNC
Do not flush cached information to disk.
The DB_NOSYNC flag is a dangerous option. It should
only be set if the application is doing logging (with
transactions) so that the database is recoverable
after a system or application crash, or if the
database is always generated from scratch after any
system or application crash.
<B>It</B> <B>is</B> <B>important</B> <B>to</B> <B>understand</B> <B>that</B> <B>flushing</B> <B>cached</B>
<B>information</B> <B>to</B> <B>disk</B> <B>only</B> <B>minimizes</B> <B>the</B> <B>window</B> <B>of</B>
<B>opportunity</B> <B>for</B> <B>corrupted</B> <B>data.</B> While unlikely, it
is possible for database corruption to happen if a
system or application crash occurs while writing data
to the database. To ensure that database corruption
never occurs, applications must either: use
transactions and logging with automatic recovery, use
logging and application-specific recovery, or edit a
copy of the database, and, once all applications
using the database have successfully called close,
replace the original database with the updated copy.
When multiple threads are using the Db handle
concurrently, only a single thread may call the Db
handle close method.
The close method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns
the value of errno on failure and 0 on success.
int Db::cursor(DbTxn *txnid, Dbc **cursorp);
A method to create a cursor and copy a pointer to it
into the memory referenced by cursorp.
A cursor is an object used to provide sequential
access through a database.
If the file is being accessed under transaction
protection, the txnid parameter is a transaction ID
returned from txn_begin, otherwise, NULL. If
transaction protection is enabled, cursors must be
opened and closed within the context of a
transaction, and the txnid parameter specifies the
transaction context in which the cursor may be used.
See <B><A HREF="Dbc.html">Dbc(3)</A></B> for more information.
The cursor method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns
the value of errno on failure and 0 on success.
int Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags);
A method to remove key/data pairs from the database.
The key/data pair associated with the specified key
is discarded from the database. In the presence of
duplicate key values, all records associated with the
designated key will be discarded.
If the file is being accessed under transaction
protection, the txnid parameter is a transaction ID
returned from txn_begin, otherwise, NULL.
The flags parameter is currently unused, and must be
set to 0.
The del method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns the
value of errno on failure, 0 on success, and
DB_NOTFOUND if the specified key did not exist in the
file.
int Db::fd(int *fdp);
A method that copies a file descriptor representative
of the underlying database into the memory referenced
by fdp. A file descriptor referencing the same file
will be returned to all processes that call Db::open
with the same file argument. This file descriptor
may be safely used as an argument to the <B>fcntl(2)</B> and
<B>flock(2)</B> locking functions. The file descriptor is
not necessarily associated with any of the underlying
files used by the access method.
The fd method only supports a coarse-grained form of
locking. Applications should use the lock manager
where possible.
The fd method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns the
value of errno on failure and 0 on success.
int Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t
flags);
A method that is an interface for keyed retrieval
from the database. The address and length of the
data associated with the specified key are returned
in the object referenced by data.
In the presence of duplicate key values, get will
return the first data item for the designated key.
Duplicates are sorted by insert order except where
this order has been overridden by cursor operations.
<B>Retrieval</B> <B>of</B> <B>duplicates</B> <B>requires</B> <B>the</B> <B>use</B> <B>of</B> <B>cursor</B>
<B>operations.</B> See <B><A HREF="Dbc.html">Dbc(3)</A></B> for details.
If the file is being accessed under transaction
protection, the txnid parameter is a transaction ID
returned from txn_begin, otherwise, NULL.
The flags parameter must be set to 0 or the following
value:
DB_GET_RECNO
Retrieve a specific numbered record from a
database. Upon return, both the key and data
items will have been filled in, not just the
data item as is done for all other uses of the
get method.
For DB_GET_RECNO to be specified, the underlying
database must be of type btree, and it must have
been created with the DB_RECNUM flag (see
<B><A HREF="Db.html">Db::open(3)</A></B>). In this case, the data field of
the key must be a pointer to a memory location
of type db_recno_t, as described in <B><A HREF="Dbt.html">Dbt(3)</A></B>.
If the database is a recno database and the requested
key exists, but was never explicitly created by the
application or was later deleted, the get method
returns DB_KEYEMPTY. Otherwise, if the requested key
isn't in the database, the get method returns
DB_NOTFOUND. Otherwise, the get method throws a
<B><A HREF="DbException.html">DbException(3)</A></B> or returns the value of errno on
failure and 0 on success.
int Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t
flags);
A method to store key/data pairs in the database. If
the database supports duplicates, the put method adds
the new data value at the end of the duplicate set.
If the file is being accessed under transaction
protection, the txnid parameter is a transaction ID
returned from txn_begin, otherwise, NULL.
The flags value is specified by <B>or</B>'ing together one
or more of the following values:
DB_APPEND
Append the key/data pair to the end of the
database. For DB_APPEND to be specified, the
underlying database must be of type recno. The
record number allocated to the record is
returned in the specified key.
DB_NOOVERWRITE
Enter the new key/data pair only if the key does
not already appear in the database.
The default behavior of the put method is to enter
the new key/data pair, replacing any previously
existing key if duplicates are disallowed, or to add
a duplicate entry if duplicates are allowed. Even if
the designated database allows duplicates, a call to
put with the DB_NOOVERWRITE flag set will fail if the
key already exists in the database.
The put method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns the
value of errno on failure, 0 on success, and
DB_KEYEXIST if the DB_NOOVERWRITE flag was set and
the key already exists in the file.
int Db::sync(u_int32_t flags);
A method to flush any cached information to disk. If
the database is in memory only, the sync method has
no effect and will always succeed.
The flags parameter is currently unused, and must be
set to 0.
See the close method description above for a
discussion of Db and cached data.
The sync method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns
the value of errno on failure and 0 on success.
int Db::stat(void *sp,
void *(*db_malloc)(size_t), u_int32_t flags);
A method to create a statistical structure and copy a
pointer to it into user-specified memory locations.
Specifically, if sp is non-NULL, a pointer to the
statistics for the database are copied into the
memory location it references.
Statistical structures are created in allocated
memory. If db_malloc is non-NULL, it is called to
allocate the memory, otherwise, the library function
<B>malloc(3)</B> is used. The function db_malloc must match
the calling conventions of the <B>malloc(3)</B> library
routine. Regardless, the caller is responsible for
deallocating the returned memory. To deallocate the
returned memory, free each returned memory pointer;
pointers inside the memory do not need to be
individually freed.
<B>In</B> <B>the</B> <B>presence</B> <B>of</B> <B>multiple</B> <B>threads</B> <B>or</B> <B>processes</B>
<B>accessing</B> <B>an</B> <B>active</B> <B>database,</B> <B>the</B> <B>returned</B>
<B>information</B> <B>may</B> <B>be</B> <B>out-of-date.</B>
<B>This</B> <B>method</B> <B>may</B> <B>access</B> <B>all</B> <B>of</B> <B>the</B> <B>pages</B> <B>in</B> <B>the</B>
<B>database,</B> <B>and</B> <B>therefore</B> <B>may</B> <B>incur</B> <B>a</B> <B>severe</B>
<B>performance</B> <B>penalty</B> <B>and</B> <B>have</B> <B>obvious</B> <B>negative</B> <B>effects</B>
<B>on</B> <B>the</B> <B>underlying</B> <B>buffer</B> <B>pool.</B>
The flags parameter must be set to 0 or the following
value:
DB_RECORDCOUNT
In the case of a btree or recno database, fill
in the bt_nrecs field, but do not collect any
other information. This flag makes it
reasonable for applications to request a record
count from a database without incurring a
performance penalty.
The stat method throws a <B><A HREF="DbException.html">DbException(3)</A></B> or returns
the value of errno on failure and 0 on success.
In the case of a btree or recno database, the
statistics are stored in a structure of type
DB_BTREE_STAT (typedef'd in &lt;db_cxx.h&gt;). The
following fields will be filled in:
u_int32_t bt_magic;
Magic number that identifies the file as a btree
file.
u_int32_t bt_version;
The version of the btree file type.
u_int32_t bt_flags;
Permanent database flags, including DB_DUP,
DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER.
u_int32_t bt_minkey;
The bt_minkey value specified to <B><A HREF="Db.html">Db::open(3)</A></B>, if
any.
u_int32_t bt_re_len;
The re_len value specified to <B><A HREF="Db.html">Db::open(3)</A></B>, if
any.
u_int32_t bt_re_pad;
The re_pad value specified to <B><A HREF="Db.html">Db::open(3)</A></B>, if
any.
u_int32_t bt_pagesize;
Underlying tree page size.
u_int32_t bt_levels;
Number of levels in the tree.
u_int32_t bt_nrecs;
Number of data items in the tree (since there
may be multiple data items per key, this number
may not be the same as the number of keys).
u_int32_t bt_int_pg;
Number of tree internal pages.
u_int32_t bt_leaf_pg;
Number of tree leaf pages.
u_int32_t bt_dup_pg;
Number of tree duplicate pages.
u_int32_t bt_over_pg;
Number of tree overflow pages.
u_int32_t bt_free;
Number of pages on the free list.
u_int32_t bt_freed;
Number of pages made available for reuse because
they were emptied.
u_int32_t bt_int_pgfree;
Number of bytes free in tree internal pages.
u_int32_t bt_leaf_pgfree;
Number of bytes free in tree leaf pages.
u_int32_t bt_dup_pgfree;
Number of bytes free in tree duplicate pages.
u_int32_t bt_over_pgfree;
Number of bytes free in tree overflow pages.
u_int32_t bt_pfxsaved;
Number of bytes saved by prefix compression.
u_int32_t bt_split;
Total number of tree page splits (includes fast
and root splits).
u_int32_t bt_rootsplit;
Number of root page splits.
u_int32_t bt_fastsplit;
Number of fast splits. When sorted keys are
added to the database, the Db btree
implementation will split left or right to
increase the page-fill factor. This number is a
measure of how often it was possible to make
such a split.
u_int32_t bt_added;
Number of keys added.
u_int32_t bt_deleted;
Number of keys deleted.
u_int32_t bt_get;
Number of keys retrieved. (Note, this value
will not reflect any keys retrieved when the
database was open for read-only access, as there
is no permanent location to store the
information in this case.)
u_int32_t bt_cache_hit;
Number of hits in tree fast-insert code. When
sorted keys are added to the database, the Db
btree implementation will check the last page
where an insert occurred before doing a full
lookup. This number is a measure of how often
the lookup was successful.
u_int32_t bt_cache_miss;
Number of misses in tree fast-insert code. See
the description of bt_cache_hit; this number is
a measure of how often the lookup failed.
</PRE>
<H2>ENVIRONMENT VARIABLES</H2><PRE>
The following environment variables affect the execution
of Db::open:
DB_HOME
If the dbenv argument to Db::open was initialized
using db_appinit, the environment variable DB_HOME
may be used as the path of the database home for the
interpretation of the dir argument to Db::open, as
described in <B><A HREF="db_appinit.html">db_appinit(3)</A></B>. Specifically, Db::open
is affected by the configuration string value of
DB_DATA_DIR.
</PRE>
<H2>EXAMPLES</H2><PRE>
Applications that create short-lived databases that are
discarded or recreated when the system fails and are
unconcerned with concurrent access and loss of data due to
catastrophic failure, may wish to use the Db::open
functionality without other parts of the Db library. Such
applications will only be concerned with the Db access
methods. The Db access methods will use the memory pool
subsystem, but the application is unlikely to be aware of
this. See the file examples_cxx/AccessExample.cpp in the
Db source distribution for a C++ language code example of
how such an application might use the Db library.
</PRE>
<H2>ERRORS</H2><PRE>
Methods marked as returning errno will, by default, throw
an exception that encapsulates the error information. The
default error behavior can be changed, see <B><A HREF="DbException.html">DbException(3)</A></B>.
The Db::open method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="Db.html">Db::sync(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::get(3)</A></B>, <B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>,
<B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>, <B><A HREF="DbLog.html">DbLog::db_register(3)</A></B>, <B><A HREF="DbLog.html">DbLog::put(3)</A></B>,
<B><A HREF="DbMpool.html">DbMpool::close(3)</A></B>, <B><A HREF="DbMpool.html">DbMpool::db_register(3)</A></B>,
<B><A HREF="DbMpool.html">DbMpool::open(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::close(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::open(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::sync(3)</A></B>, <B>calloc(3)</B>, <B>close(2)</B>, <B>fcntl(2)</B>,
<B>fflush(3)</B>, <B>malloc(3)</B>, <B>memcpy(3)</B>, <B>memmove(3)</B>, <B>memset(3)</B>,
<B>mmap(2)</B>, <B>munmap(2)</B>, <B>open(2)</B>, <B>read(2)</B>, <B>realloc(3)</B>,
<B>sigfillset(3)</B>, <B>sigprocmask(2)</B>, <B>stat(2)</B>, <B>strcpy(3)</B>,
<B>strdup(3)</B>, <B>strerror(3)</B>, <B>strlen(3)</B>, <B>time(3)</B>, and <B>unlink(2)</B>.
In addition, the Db::open method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EAGAIN]
A lock was unavailable.
[EINVAL]
An invalid flag value or parameter was specified
(e.g., unknown database type, page size, hash method,
recno pad byte, byte order) or a flag value or
parameter that is incompatible with the current file
specification.
The DB_THREAD flag was specified and spinlocks are
not implemented for this architecture.
There is a mismatch between the version number of
file and the software.
A re_source file was specified with either the
DB_THREAD flag or a non-NULL tx_info field in the
DbEnv argument to Db::open.
[ENOENT]
A non-existent re_source file was specified.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
The Db::close method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="Db.html">Db::sync(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::get(3)</A></B>, <B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>,
<B><A HREF="DbLog.html">DbLog::db_register(3)</A></B>, <B><A HREF="DbLog.html">DbLog::put(3)</A></B>, <B><A HREF="DbMpool.html">DbMpool::close(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::close(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::sync(3)</A></B>, <B>calloc(3)</B>, <B>close(2)</B>, <B>fflush(3)</B>,
<B>malloc(3)</B>, <B>memcpy(3)</B>, <B>memmove(3)</B>, <B>memset(3)</B>, <B>munmap(2)</B>,
<B>realloc(3)</B>, and <B>strerror(3)</B>.
The Db::cursor method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B>calloc(3)</B>.
In addition, the Db::cursor method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EINVAL]
An invalid flag value or parameter was specified.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
The Db::del method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="DbLock.html">DbLock::get(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>,
<B><A HREF="DbLog.html">DbLog::put(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>, <B>calloc(3)</B>, <B>fcntl(2)</B>, <B>fflush(3)</B>,
<B>malloc(3)</B>, <B>memcmp(3)</B>, <B>memcpy(3)</B>, <B>memmove(3)</B>, <B>memset(3)</B>,
<B>realloc(3)</B>, and <B>strerror(3)</B>.
In addition, the Db::del method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EAGAIN]
A lock was unavailable.
[EINVAL]
An invalid flag value or parameter was specified.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
In addition, the Db::fd method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[ENOENT]
The Db::fd method was called for an in-memory
database, or no underlying file has yet been created.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
The Db::get method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="DbLock.html">DbLock::get(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>,
<B><A HREF="DbLog.html">DbLog::put(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>, <B><A HREF="Dbc.html">Dbc::get(3)</A></B>, <B>calloc(3)</B>, <B>fcntl(2)</B>,
<B>fflush(3)</B>, <B>malloc(3)</B>, <B>memcmp(3)</B>, <B>memcpy(3)</B>, <B>memmove(3)</B>,
<B>memset(3)</B>, <B>realloc(3)</B>, and <B>strerror(3)</B>.
In addition, the Db::get method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EAGAIN]
A lock was unavailable.
[EINVAL]
An invalid flag value or parameter was specified.
The DB_THREAD flag was specified to the <B><A HREF="Db.html">Db::open(3)</A></B>
method and neither the DB_DBT_MALLOC or
DB_DBT_USERMEM flags were set in the Dbt.
A record number of 0 was specified.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
The Db::put method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="DbLock.html">DbLock::get(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>,
<B><A HREF="DbLog.html">DbLog::put(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>, <B>calloc(3)</B>, <B>fcntl(2)</B>, <B>fflush(3)</B>,
<B>malloc(3)</B>, <B>memcmp(3)</B>, <B>memcpy(3)</B>, <B>memmove(3)</B>, <B>memset(3)</B>,
<B>realloc(3)</B>, and <B>strerror(3)</B>.
In addition, the Db::put method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EACCES]
An attempt was made to modify a read-only database.
[EAGAIN]
A lock was unavailable.
[EINVAL]
An invalid flag value or parameter was specified.
A record number of 0 was specified.
An attempt was made to add a record to a fixed-length
database that was too large to fit.
An attempt was made to do a partial put.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
[ENOSPC]
A btree exceeded the maximum btree depth (255).
The Db::stat method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="DbLock.html">DbLock::get(3)</A></B>,
<B><A HREF="DbLock.html">DbLock::put(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>, <B>calloc(3)</B>,
<B>fcntl(2)</B>, <B>fflush(3)</B>, <B>malloc(3)</B>, <B>memcpy(3)</B>, and <B>memset(3)</B>.
The Db::sync method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
or return errno for any of the errors specified for the
following DB and library functions: <B><A HREF="Db.html">Db::get(3)</A></B>,
<B><A HREF="Db.html">Db::sync(3)</A></B>, <B><A HREF="DbLock.html">DbLock::get(3)</A></B>, <B><A HREF="DbLock.html">DbLock::put(3)</A></B>,
<B><A HREF="DbLockTab.html">DbLockTab::id(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab::vec(3)</A></B>, <B><A HREF="DbLog.html">DbLog::put(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::get(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::put(3)</A></B>,
<B><A HREF="DbMpoolFile.html">DbMpoolFile::set(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile::sync(3)</A></B>, <B>calloc(3)</B>,
<B>close(2)</B>, <B>fcntl(2)</B>, <B>fflush(3)</B>, <B>malloc(3)</B>, <B>memcpy(3)</B>,
<B>memmove(3)</B>, <B>memset(3)</B>, <B>munmap(2)</B>, <B>open(2)</B>, <B>realloc(3)</B>,
<B>strerror(3)</B>, <B>unlink(2)</B>, and <B>write(2)</B>.
In addition, the Db::sync method may fail and throw a
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
conditions:
[EINVAL]
An invalid flag value or parameter was specified.
[EPERM]
Database corruption was detected. All subsequent
database calls (other than Db::close) will return
EPERM.
</PRE>
<H2>SEE ALSO</H2><PRE>
The Ubiquitous B-tree, Douglas Comer, ACM Comput. Surv.
11, 2 (June 1979), 121-138.
Prefix B-trees, Bayer and Unterauer, ACM Transactions on
Database Systems, Vol. 2, 1 (March 1977), 11-26.
The Art of Computer Programming Vol. 3: Sorting and
Searching, D.E. Knuth, 1968, pp 471-480.
Dynamic Hash Tables, Per-Ake Larson, Communications of the
ACM, April 1988.
A New Hash Package for UNIX, Margo Seltzer, USENIX
Proceedings, Winter 1991.
Document Processing in a Relational Database System,
Michael Stonebraker, Heidi Stettner, Joseph Kalash,
Antonin Guttman, Nadene Lynn, Memorandum No. UCB/ERL
M82/32, May 1982.
<B><A HREF="db_archive.html">db_archive(1)</A></B>, <B><A HREF="db_checkpoint.html">db_checkpoint(1)</A></B>, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>, <B><A HREF="db_dump.html">db_dump(1)</A></B>,
<B><A HREF="db_load.html">db_load(1)</A></B>, <B><A HREF="db_recover.html">db_recover(1)</A></B>, <B><A HREF="db_stat.html">db_stat(1)</A></B>, <B><A HREF="db_intro.html">db_intro(3)</A></B>,
<B><A HREF="db_internal.html">db_internal(3)</A></B>, <B><A HREF="db_thread.html">db_thread(3)</A></B>, <B><A HREF="Db.html">Db(3)</A></B>, <B><A HREF="Dbc.html">Dbc(3)</A></B>, <B><A HREF="DbEnv.html">DbEnv(3)</A></B>,
<B><A HREF="DbException.html">DbException(3)</A></B>, <B><A HREF="DbInfo.html">DbInfo(3)</A></B>, <B><A HREF="DbLock.html">DbLock(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab(3)</A></B>, <B><A HREF="DbLog.html">DbLog(3)</A></B>,
<B><A HREF="DbLsn.html">DbLsn(3)</A></B>, <B><A HREF="DbMpool.html">DbMpool(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile(3)</A></B>, <B><A HREF="Dbt.html">Dbt(3)</A></B>, <B><A HREF="DbTxn.html">DbTxn(3)</A></B>,
<B><A HREF="DbTxnMgr.html">DbTxnMgr(3)</A></B>
</PRE>
<HR SIZE=1 NOSHADE>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>