98 lines
4.7 KiB
HTML
98 lines
4.7 KiB
HTML
<!--$Id: db_class.html 63573 2008-05-23 21:43:21Z trent.nelson $-->
|
|
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
|
|
<!--See the file LICENSE for redistribution information.-->
|
|
<html>
|
|
<head>
|
|
<title>Berkeley DB: db_create</title>
|
|
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
|
|
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
|
|
</head>
|
|
<body bgcolor=white>
|
|
<table width="100%"><tr valign=top>
|
|
<td>
|
|
<b>db_create</b>
|
|
</td>
|
|
<td align=right>
|
|
<a href="../api_c/api_core.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>
|
|
<b><pre>
|
|
#include <db.h>
|
|
<p>
|
|
typedef struct __db DB;
|
|
<p>
|
|
int
|
|
db_create(DB **dbp, DB_ENV *dbenv, u_int32_t flags);
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: db_create</b>
|
|
<p>The DB handle is the handle for a Berkeley DB database, which may or
|
|
may not be part of a database environment.</p>
|
|
<p>DB handles are free-threaded if the <a href="../api_c/env_open.html#DB_THREAD">DB_THREAD</a> flag is
|
|
specified to the <a href="../api_c/db_open.html">DB->open</a> method when the database is opened or if the
|
|
database environment in which the database is opened is free-threaded.
|
|
The handle should not be closed while any other handle that refers to
|
|
the database is in use; for example, database handles must not be closed
|
|
while cursor handles into the database remain open, or transactions that
|
|
include operations on the database have not yet been committed or
|
|
aborted. Once the <a href="../api_c/db_close.html">DB->close</a>, <a href="../api_c/db_remove.html">DB->remove</a>,
|
|
<a href="../api_c/db_rename.html">DB->rename</a>, or <a href="../api_c/db_verify.html">DB->verify</a> methods are called, the handle may
|
|
not be accessed again, regardless of the method's return.</p>
|
|
<p>The db_create function creates a DB structure that is
|
|
the handle for a Berkeley DB database. This function allocates memory for the
|
|
structure, returning a pointer to the structure in the memory to which
|
|
<b>dbp</b> refers. To release the allocated memory and discard the
|
|
handle, call the <a href="../api_c/db_close.html">DB->close</a>, <a href="../api_c/db_remove.html">DB->remove</a>,
|
|
<a href="../api_c/db_rename.html">DB->rename</a>, or <a href="../api_c/db_verify.html">DB->verify</a> methods.</p>
|
|
<p>The DB handle contains a special field, "app_private", which is
|
|
declared as type "void *". This field is provided for the use of the
|
|
application program. It is initialized to NULL and is not further used
|
|
by Berkeley DB in any way.</p>
|
|
<p>The db_create method
|
|
returns a non-zero error value on failure
|
|
and 0 on success.
|
|
</p>
|
|
<b>Parameters</b> <br>
|
|
<b>dbp</b><ul compact><li>The <b>dbp</b> parameter references the memory into which the returned
|
|
structure pointer is stored.</ul>
|
|
<b>dbenv</b><ul compact><li>If the <b>dbenv</b> parameter is NULL, the database is standalone; that
|
|
is, it is not part of any Berkeley DB environment.
|
|
<p>If the <b>dbenv</b> parameter is not NULL, the database is created
|
|
within the specified Berkeley DB environment. The database access methods
|
|
automatically make calls to the other subsystems in Berkeley DB, based on the
|
|
enclosing environment. For example, if the environment has been
|
|
configured to use locking, the access methods will automatically acquire
|
|
the correct locks when reading and writing pages of the database.</p></ul>
|
|
<b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
|
|
the following value:
|
|
<br>
|
|
<b><a name="DB_XA_CREATE">DB_XA_CREATE</a></b><ul compact><li>Instead of creating a standalone database, create a database intended
|
|
to be accessed via applications running under an X/Open conformant
|
|
Transaction Manager. The database will be opened in the environment
|
|
specified by the OPENINFO parameter of the GROUPS section of the
|
|
ubbconfig file. See the <a href="../ref/xa/xa_intro.html">XA
|
|
Introduction</a> section in the Berkeley DB Reference Guide for more information.</ul>
|
|
<br></ul>
|
|
<br>
|
|
<br><b>Errors</b>
|
|
<p>The db_create method
|
|
may fail and return one of the following non-zero errors:</p>
|
|
<br>
|
|
<b>EINVAL</b><ul compact><li>An
|
|
invalid flag value or parameter was specified.</ul>
|
|
<br>
|
|
<hr size=1 noshade>
|
|
<br><b>Class</b>
|
|
DB
|
|
<br><b>See Also</b>
|
|
<a href="../api_c/db_list.html">Databases and Related Methods</a>
|
|
</tt>
|
|
<table width="100%"><tr><td><br></td><td align=right>
|
|
<a href="../api_c/api_core.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>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
|
|
</body>
|
|
</html>
|