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: DB_SEQUENCE->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>DB_SEQUENCE->open</b> 14</td> 15<td align=right> 16<a href="/api_c/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.h> 23<p> 24int 25DB_SEQUENCE->open(DB_SEQUENCE *seq, DB_TXN *txnid, DBT *key, u_int32_t flags); 26<p> 27int 28DB_SEQUENCE->get_dbp(DB_SEQUENCE *seq, DB **dbp); 29<p> 30int 31DB_SEQUENCE->get_key(DB_SEQUENCE *seq, DBT *key); 32<p> 33int 34</pre></b> 35<hr size=1 noshade> 36<b>Description: DB_SEQUENCE->open</b> 37<p>The DB_SEQUENCE->open method opens the sequence represented by the <b>key</b>. 38The key must be compatible with the underlying database specified in the 39corresponding call to <a href="/api_c/seq_class.html">db_sequence_create</a>.</p> 40<b>Parameters</b> <br> 41 <b>key</b><ul compact><li>The <b>key</b> specifies which record in the database stores 42the persistent sequence data.</ul> 43 <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 44or more of the following values: 45<br> 46<b><a name="DB_CREATE">DB_CREATE</a></b><ul compact><li>Create the sequence. If the sequence does not already exist and the 47DB_CREATE flag is not specified, the DB_SEQUENCE->open will fail.</ul> 48<b><a name="DB_EXCL">DB_EXCL</a></b><ul compact><li>Return an error if the sequence already exists. The <a href="/api_c/db_open.html#DB_EXCL">DB_EXCL</a> 49flag is only meaningful when specified with the <a href="/api_c/env_open.html#DB_CREATE">DB_CREATE</a> 50flag.</ul> 51<b><a name="DB_THREAD">DB_THREAD</a></b><ul compact><li>Cause the <a href="/api_c/seq_class.html">DB_SEQUENCE</a> handle returned by DB_SEQUENCE->open to be 52<i>free-threaded</i>; that is, usable by multiple threads within a 53single address space. Note that if multiple threads create multiple 54sequences using the same database handle that handle must have been 55opened specifying <a name="DB_THREAD">DB_THREAD</a>.</ul> 56<br></ul> 57 <b>txnid</b><ul compact><li>If the operation is part of an application-specified transaction, the 58<b>txnid</b> parameter is a transaction handle returned from 59<a href="/api_c/txn_begin.html">DB_ENV->txn_begin</a>; if the operation is part of a Berkeley DB Concurrent Data Store group, the 60<b>txnid</b> parameter is a handle returned from 61<a href="/api_c/env_cdsgroup_begin.html">DB_ENV->cdsgroup_begin</a>; otherwise NULL. 62If no transaction handle is 63specified, but the 64operation occurs in a transactional 65database, 66the operation will be implicitly transaction protected. 67Transactionally protected operations on a <a href="/api_c/seq_class.html">DB_SEQUENCE</a> handle 68require the <a href="/api_c/seq_class.html">DB_SEQUENCE</a> handle itself be transactionally 69protected during its open if the open creates the sequence.</ul> 70<br> 71<hr size=1 noshade> 72<b>Description: DB_SEQUENCE->get_dbp</b> 73<p>The DB_SEQUENCE->get_dbp method returns the database handle.</p> 74<b>Parameters</b> <br> 75 <b>dbp</b><ul compact><li>The <b>dbp</b> parameter references memory into which 76a pointer to the database handle is copied.</ul> 77<br> 78<p>The DB_SEQUENCE->get_dbp method may be called at any time during the life of the 79application.</p> 80<p>The DB_SEQUENCE->get_dbp method 81returns a non-zero error value on failure 82and 0 on success. 83</p> 84<hr size=1 noshade> 85<b>Description: DB_SEQUENCE->get_key</b> 86<p>The DB_SEQUENCE->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 DB_SEQUENCE->get_key method may be called at any time during the life of the 92application.</p> 93<p>The DB_SEQUENCE->get_key method 94returns a non-zero error value on failure 95and 0 on success. 96</p> 97<hr size=1 noshade> 98<br><b>Class</b> 99<a href="/api_c/seq_class.html">DB_SEQUENCE</a> 100<br><b>See Also</b> 101<a href="/api_c/seq_list.html">Sequences and Related Methods</a> 102</tt> 103<table width="100%"><tr><td><br></td><td align=right> 104<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> 105</td></tr></table> 106<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 107</body> 108</html> 109