1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Dbc::dup()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="dbc.html" title="Chapter 3. The Dbc Handle" />
11 <link rel="prev" href="dbcdel.html" title="Dbc::del()" />
12 <link rel="next" href="dbcget.html" title="Dbc::get()" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">Dbc::dup()</th>
24 <td width="20%" align="left"><a accesskey="p" href="dbcdel.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 3.
28 <td width="20%" align="right"> <a accesskey="n" href="dbcget.html">Next</a></td>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
37 <h2 class="title" style="clear: both"><a id="dbcdup"></a>Dbc::dup()</h2>
41 <pre class="programlisting">#include <db_cxx.h>
44 Dbc::dup(Dbc **cursorp, u_int32_t flags);</pre>
46 The <code class="methodname">Dbc::dup()</code> method creates a new cursor that uses the same
47 transaction and locker ID as the original cursor. This is useful when
48 an application is using locking and requires two or more cursors in
49 the same thread of control.
52 The <code class="methodname">Dbc::dup()</code> <span>
55 method either returns a non-zero error value or throws an
56 exception that encapsulates a non-zero error value on
57 failure, and returns 0 on success.
61 <div class="sect2" lang="en" xml:lang="en">
62 <div class="titlepage">
65 <h3 class="title"><a id="idp819344"></a>Parameters</h3>
69 <div class="sect3" lang="en" xml:lang="en">
70 <div class="titlepage">
73 <h4 class="title"><a id="idp819832"></a>cursorp</h4>
78 The <code class="methodname">Dbc::dup()</code> method
79 returns the newly created cursor in
80 <span class="bold"><strong>cursorp</strong></span>.
83 <div class="sect3" lang="en" xml:lang="en">
84 <div class="titlepage">
87 <h4 class="title"><a id="idp805520"></a>flags</h4>
92 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
93 or the following flag:
95 <div class="itemizedlist">
98 <p><a id="dup_DB_POSITION"></a>
99 <code class="literal">DB_POSITION</code>
102 The newly created cursor is initialized to refer to the same position
103 in the database as the original cursor (if any) and hold the same
104 locks (if any). If the DB_POSITION flag is not specified, or the
105 original cursor does not hold a database position and locks, the
106 created cursor is uninitialized and will behave like a cursor newly
107 created using the <a class="xref" href="dbcursor.html" title="Db::cursor()">Db::cursor()</a>
115 <div class="sect2" lang="en" xml:lang="en">
116 <div class="titlepage">
119 <h3 class="title"><a id="idp826608"></a>Errors</h3>
124 The <code class="methodname">Dbc::dup()</code> <span>
127 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
128 exception, encapsulating one of the following non-zero errors, or return one
129 of the following non-zero errors:
133 <div class="sect3" lang="en" xml:lang="en">
134 <div class="titlepage">
137 <h4 class="title"><a id="idp834632"></a> <span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4>
142 When a client synchronizes with the master, it is possible for committed
143 transactions to be rolled back. This invalidates all the database and cursor
144 handles opened in the replication environment. Once this occurs, an attempt to use
147 throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if
148 your application is configured to throw exceptions), or
150 return <code class="literal">DB_REP_HANDLE_DEAD</code>.
151 The application will need to discard the handle and open a new one in order to
155 <div class="sect3" lang="en" xml:lang="en">
156 <div class="titlepage">
159 <h4 class="title"><a id="idp813280"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4>
164 The operation was blocked by client/master synchronization.
167 <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
168 your Berkeley DB API is configured to throw exceptions.
169 Otherwise, <code class="literal">DB_REP_LOCKOUT</code> is returned.
172 <div class="sect3" lang="en" xml:lang="en">
173 <div class="titlepage">
176 <h4 class="title"><a id="idp827576"></a>EINVAL</h4>
181 An invalid flag value or parameter was specified.
185 <div class="sect2" lang="en" xml:lang="en">
186 <div class="titlepage">
189 <h3 class="title"><a id="idp829848"></a>Class</h3>
194 <a class="link" href="dbc.html" title="Chapter 3. The Dbc Handle">Dbc</a>
197 <div class="sect2" lang="en" xml:lang="en">
198 <div class="titlepage">
201 <h3 class="title"><a id="idp827056"></a>See Also</h3>
206 <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a>
210 <div class="navfooter">
212 <table width="100%" summary="Navigation footer">
214 <td width="40%" align="left"><a accesskey="p" href="dbcdel.html">Prev</a> </td>
215 <td width="20%" align="center">
216 <a accesskey="u" href="dbc.html">Up</a>
218 <td width="40%" align="right"> <a accesskey="n" href="dbcget.html">Next</a></td>
221 <td width="40%" align="left" valign="top">Dbc::del() </td>
222 <td width="20%" align="center">
223 <a accesskey="h" href="index.html">Home</a>
225 <td width="40%" align="right" valign="top"> Dbc::get()</td>