seq_open.html   [plain text]


<!--$Id: seq_open.so,v 1.9 2005/01/20 01:15:15 ubell Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbSequence::open</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>DbSequence::open</b>
</td>
<td align=right>
<a href="../api_cxx/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 &lt;db_cxx.h&gt;
<p>
int
int
DbSequence::open(DbTxn *txnid, Dbt *key, u_int32_t flags);
<p>
int
DbSequence::get_dbp(Db **dbp);
<p>
int
DbSequence::get_key(Dbt *key);
</pre></b>
<hr size=1 noshade>
<b>Description: DbSequence::open</b>
<p>The DbSequence::open method opens the sequence represented by the <b>key</b>.
The key must be compatible with the underlying database specified in the
corresponding call to <a href="../api_c/seq_class.html">db_sequence_create</a>.</p>
<b>Parameters</b> <br>
 <b>key</b><ul compact><li>The <b>key</b> specifies which record in the database stores
the persistent sequence data.</ul>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<br>
<b><a name="DB_CREATE">DB_CREATE</a></b><ul compact><li>Create the sequence.  If the sequence does not already exist and the
DB_CREATE flag is not specified, the DbSequence::open will fail.</ul>
<b><a name="DB_EXCL">DB_EXCL</a></b><ul compact><li>Return an error if the sequence already exists.  The <a href="../api_cxx/db_open.html#DB_EXCL">DB_EXCL</a>
flag is only meaningful when specified with the <a href="../api_cxx/env_open.html#DB_CREATE">DB_CREATE</a>
flag.</ul>
<b><a name="DB_THREAD">DB_THREAD</a></b><ul compact><li>Cause the <a href="../api_cxx/seq_class.html">DbSequence</a> handle returned by DbSequence::open to be
<i>free-threaded</i>; that is, usable by multiple threads within a
single address space.  Note that if multiple threads create multiple
sequences using the same database handle that handle must have been
opened specifying <a name="DB_THREAD">DB_THREAD</a>.</ul>
<br></ul>
 <b>txnid</b><ul compact><li>If the operation is part of an application-specified transaction, the
<b>txnid</b> parameter is a transaction handle returned from
<a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; if the operation is part of a Berkeley DB Concurrent Data Store group, the
<b>txnid</b> parameter is a handle returned from
<a href="../api_cxx/env_cdsgroup_begin.html">DbEnv::cdsgroup_begin</a>; otherwise NULL.
If no transaction handle is
specified, but the
operation occurs in a transactional
database,
the operation will be implicitly transaction protected.
Transactionally protected operations on a <a href="../api_cxx/seq_class.html">DbSequence</a> handle
require the <a href="../api_cxx/seq_class.html">DbSequence</a> handle itself be transactionally
protected during its open if the open creates the sequence.</ul>
<br>
<hr size=1 noshade>
<b>Description: DbSequence::get_dbp</b>
<p>The DbSequence::get_dbp method returns the database handle.</p>
<b>Parameters</b> <br>
 <b>dbp</b><ul compact><li>The <b>dbp</b> parameter references memory into which
a pointer to the database handle is copied.</ul> 
<br>
<p>The DbSequence::get_dbp method may be called at any time during the life of the
application.</p>
<p>The DbSequence::get_dbp 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>
<hr size=1 noshade>
<b>Description: DbSequence::get_key</b>
<p>The DbSequence::get_key method returns the key for the sequence.</p>
<b>Parameters</b> <br>
 <b>key</b><ul compact><li>The <b>key</b> parameter references memory into which
a pointer to the key data is copied.</ul> 
<br>
<p>The DbSequence::get_key method may be called at any time during the life of the
application.</p>
<p>The DbSequence::get_key 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>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/seq_class.html">DbSequence</a>
<br><b>See Also</b>
<a href="../api_cxx/seq_list.html">Sequences and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/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>