<!--$Id: db_cursor.so,v 10.55 2007/10/24 16:06:06 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: Db::cursor</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::cursor</b>
</td>
<td align=right>
<a href="../../db4-devel-4.7.25/api_cxx/api_core.html"><img src="../../db4-devel-4.7.25/images/api.gif" alt="API"></a>
<a href="../../db4-devel-4.7.25/ref/toc.html"><img src="../../db4-devel-4.7.25/images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include <db_cxx.h>
<p>
int
Db::cursor(DbTxn *txnid, Dbc **cursorp, u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: Db::cursor</b>
<p>The Db::cursor method returns a created database cursor.</p>
<p>Cursors may span threads, but only serially, that is, the application
must serialize access to the cursor handle.</p>
<p>The Db::cursor 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>
<b>Parameters</b> <br>
<b>cursorp</b><ul compact><li>The <b>cursorp</b> parameter references memory into which
a pointer to the allocated cursor is copied.</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_READ_COMMITTED">DB_READ_COMMITTED</a></b><ul compact><li>Configure a transactional cursor to have degree 2 isolation. This ensures
the stability of the current data item read by this cursor but permits data
read by this cursor to be modified or deleted prior to the commit of the
transaction for this cursor.</ul>
<b><a name="DB_READ_UNCOMMITTED">DB_READ_UNCOMMITTED</a></b><ul compact><li>Configure a transactional cursor to have degree 1 isolation. Read
operations performed by the cursor may return modified but not yet
committed data. Silently ignored if the <a href="../../db4-devel-4.7.25/api_cxx/db_open.html#DB_READ_UNCOMMITTED">DB_READ_UNCOMMITTED</a>
flag was not specified when the underlying database was opened.</ul>
<b><a name="DB_WRITECURSOR">DB_WRITECURSOR</a></b><ul compact><li>Specify that the cursor will be used to update the database. The
underlying database environment must have been opened using the
<a href="../../db4-devel-4.7.25/api_cxx/env_open.html#DB_INIT_CDB">DB_INIT_CDB</a> flag.</ul>
<b><a name="DB_TXN_SNAPSHOT">DB_TXN_SNAPSHOT</a></b><ul compact><li>Configure a transactional cursor to operate with read-only
<a href="../../db4-devel-4.7.25/ref/transapp/read.html">snapshot isolation</a>. For databases
with the <a href="../../db4-devel-4.7.25/api_cxx/db_open.html#DB_MULTIVERSION">DB_MULTIVERSION</a> flag set, data values will be read as
they are when the cursor is opened, without taking read locks. This
flag implicitly begins a transaction that is committed when the cursor
is closed. Silently ignored if <a href="../../db4-devel-4.7.25/api_cxx/db_open.html#DB_MULTIVERSION">DB_MULTIVERSION</a> not set on the
underlying database or if a transaction is supplied in the <b>txnid</b>
parameter.</ul>
<br></ul>
<b>txnid</b><ul compact><li>Cursor operations are not automatically transaction-protected, even if
the <a href="../../db4-devel-4.7.25/api_cxx/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> flag is specified to the
<a href="../../db4-devel-4.7.25/api_cxx/env_set_flags.html">DbEnv::set_flags</a> or <a href="../../db4-devel-4.7.25/api_cxx/db_open.html">Db::open</a> methods. If cursor operations are
to be transaction-protected, the <b>txnid</b> parameter must be a
transaction handle returned from <a href="../../db4-devel-4.7.25/api_cxx/txn_begin.html">DbEnv::txn_begin</a>; otherwise, NULL. To
transaction-protect cursor operations, cursors must be opened and closed
within the context of a transaction, and the <b>txnid</b> parameter
specifies the transaction context in which the cursor may be used.</ul>
<br>
<br><b>Errors</b>
<p>The Db::cursor method
may fail and throw
<a href="../../db4-devel-4.7.25/api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>DB_REP_HANDLE_DEAD</b><ul compact><li>The database handle has been invalidated because a replication election
unrolled a committed transaction.</ul>
<br>
<br>
<b>DB_REP_LOCKOUT</b><ul compact><li>The operation was blocked by client/master synchronization.</ul>
<br>
<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>
<a href="../../db4-devel-4.7.25/api_cxx/dbc_class.html">Dbc</a>
<br><b>See Also</b>
<a href="../../db4-devel-4.7.25/api_cxx/dbc_list.html">Database Cursors and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../../db4-devel-4.7.25/api_cxx/api_core.html"><img src="../../db4-devel-4.7.25/images/api.gif" alt="API"></a><a href="../../db4-devel-4.7.25/ref/toc.html"><img src="../../db4-devel-4.7.25/images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
</body>
</html>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez