1<!--$Id: seq_open.so,v 1.9 2005/01/20 01:15:15 ubell Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DbSequence::open</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DbSequence::open</b> 14</td> 15<td align=right> 16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db_cxx.h> 23<p> 24int 25int 26DbSequence::open(DbTxn *txnid, Dbt *key, u_int32_t flags); 27<p> 28int 29DbSequence::get_dbp(Db **dbp); 30<p> 31int 32DbSequence::get_key(Dbt *key); 33</pre></b> 34<hr size=1 noshade> 35<b>Description: DbSequence::open</b> 36<p>The DbSequence::open method opens the sequence represented by the <b>key</b>. 37The key must be compatible with the underlying database specified in the 38corresponding call to <a href="../api_c/seq_class.html">db_sequence_create</a>.</p> 39<b>Parameters</b> <br> 40 <b>key</b><ul compact><li>The <b>key</b> specifies which record in the database stores 41the persistent sequence data.</ul> 42 <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 43or more of the following values: 44<br> 45<b><a name="DB_CREATE">DB_CREATE</a></b><ul compact><li>Create the sequence. If the sequence does not already exist and the 46DB_CREATE flag is not specified, the DbSequence::open will fail.</ul> 47<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> 48flag is only meaningful when specified with the <a href="../api_cxx/env_open.html#DB_CREATE">DB_CREATE</a> 49flag.</ul> 50<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 51<i>free-threaded</i>; that is, usable by multiple threads within a 52single address space. Note that if multiple threads create multiple 53sequences using the same database handle that handle must have been 54opened specifying <a name="DB_THREAD">DB_THREAD</a>.</ul> 55<br></ul> 56 <b>txnid</b><ul compact><li>If the operation is part of an application-specified transaction, the 57<b>txnid</b> parameter is a transaction handle returned from 58<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 59<b>txnid</b> parameter is a handle returned from 60<a href="../api_cxx/env_cdsgroup_begin.html">DbEnv::cdsgroup_begin</a>; otherwise NULL. 61If no transaction handle is 62specified, but the 63operation occurs in a transactional 64database, 65the operation will be implicitly transaction protected. 66Transactionally protected operations on a <a href="../api_cxx/seq_class.html">DbSequence</a> handle 67require the <a href="../api_cxx/seq_class.html">DbSequence</a> handle itself be transactionally 68protected during its open if the open creates the sequence.</ul> 69<br> 70<hr size=1 noshade> 71<b>Description: DbSequence::get_dbp</b> 72<p>The DbSequence::get_dbp method returns the database handle.</p> 73<b>Parameters</b> <br> 74 <b>dbp</b><ul compact><li>The <b>dbp</b> parameter references memory into which 75a pointer to the database handle is copied.</ul> 76<br> 77<p>The DbSequence::get_dbp method may be called at any time during the life of the 78application.</p> 79<p>The DbSequence::get_dbp method 80either returns a non-zero error value 81or throws an exception that encapsulates a non-zero error value on 82failure, and returns 0 on success. 83</p> 84<hr size=1 noshade> 85<b>Description: DbSequence::get_key</b> 86<p>The DbSequence::get_key method returns the key for the sequence.</p> 87<b>Parameters</b> <br> 88 <b>key</b><ul compact><li>The <b>key</b> parameter references memory into which 89a pointer to the key data is copied.</ul> 90<br> 91<p>The DbSequence::get_key method may be called at any time during the life of the 92application.</p> 93<p>The DbSequence::get_key method 94either returns a non-zero error value 95or throws an exception that encapsulates a non-zero error value on 96failure, and returns 0 on success. 97</p> 98<hr size=1 noshade> 99<br><b>Class</b> 100<a href="../api_cxx/seq_class.html">DbSequence</a> 101<br><b>See Also</b> 102<a href="../api_cxx/seq_list.html">Sequences and Related Methods</a> 103</tt> 104<table width="100%"><tr><td><br></td><td align=right> 105<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> 106</td></tr></table> 107<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 108</body> 109</html> 110