Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / docs / api_reference / CXX / dbcdup.html
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">
4   <head>
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()" />
13   </head>
14   <body>
15     <div xmlns="" class="navheader">
16       <div class="libver">
17         <p>Library Version 11.2.5.3</p>
18       </div>
19       <table width="100%" summary="Navigation header">
20         <tr>
21           <th colspan="3" align="center">Dbc::dup()</th>
22         </tr>
23         <tr>
24           <td width="20%" align="left"><a accesskey="p" href="dbcdel.html">Prev</a> </td>
25           <th width="60%" align="center">Chapter 3. 
26                 The Dbc Handle
27         </th>
28           <td width="20%" align="right"> <a accesskey="n" href="dbcget.html">Next</a></td>
29         </tr>
30       </table>
31       <hr />
32     </div>
33     <div class="sect1" lang="en" xml:lang="en">
34       <div class="titlepage">
35         <div>
36           <div>
37             <h2 class="title" style="clear: both"><a id="dbcdup"></a>Dbc::dup()</h2>
38           </div>
39         </div>
40       </div>
41       <pre class="programlisting">#include &lt;db_cxx.h&gt;
42  
43 int
44 Dbc::dup(Dbc **cursorp, u_int32_t flags);</pre>
45       <p>
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.
50     </p>
51       <p>
52          The <code class="methodname">Dbc::dup()</code> <span>
53             
54             <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.
58             </span>
59         </span>
60     </p>
61       <div class="sect2" lang="en" xml:lang="en">
62         <div class="titlepage">
63           <div>
64             <div>
65               <h3 class="title"><a id="idp819344"></a>Parameters</h3>
66             </div>
67           </div>
68         </div>
69         <div class="sect3" lang="en" xml:lang="en">
70           <div class="titlepage">
71             <div>
72               <div>
73                 <h4 class="title"><a id="idp819832"></a>cursorp</h4>
74               </div>
75             </div>
76           </div>
77           <p>
78                   The <code class="methodname">Dbc::dup()</code> method
79                   returns the newly created cursor in 
80                  <span class="bold"><strong>cursorp</strong></span>.
81              </p>
82         </div>
83         <div class="sect3" lang="en" xml:lang="en">
84           <div class="titlepage">
85             <div>
86               <div>
87                 <h4 class="title"><a id="idp805520"></a>flags</h4>
88               </div>
89             </div>
90           </div>
91           <p>
92                           The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
93                           or the following flag: 
94                      </p>
95           <div class="itemizedlist">
96             <ul type="disc">
97               <li>
98                 <p><a id="dup_DB_POSITION"></a>
99                   <code class="literal">DB_POSITION</code>
100             </p>
101                 <p>
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> 
108                  method.
109             </p>
110               </li>
111             </ul>
112           </div>
113         </div>
114       </div>
115       <div class="sect2" lang="en" xml:lang="en">
116         <div class="titlepage">
117           <div>
118             <div>
119               <h3 class="title"><a id="idp826608"></a>Errors</h3>
120             </div>
121           </div>
122         </div>
123         <p>
124                          The <code class="methodname">Dbc::dup()</code> <span>
125             
126             <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:
130             </span>
131         </span>
132                     </p>
133         <div class="sect3" lang="en" xml:lang="en">
134           <div class="titlepage">
135             <div>
136               <div>
137                 <h4 class="title"><a id="idp834632"></a> <span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4>
138               </div>
139             </div>
140           </div>
141           <p>
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
145                 such a handle will 
146                 <span>
147                     throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if
148                     your application is configured to throw exceptions), or 
149                 </span>
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
152                 continue processing.
153             </p>
154         </div>
155         <div class="sect3" lang="en" xml:lang="en">
156           <div class="titlepage">
157             <div>
158               <div>
159                 <h4 class="title"><a id="idp813280"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4>
160               </div>
161             </div>
162           </div>
163           <p>
164                 The operation was blocked by client/master synchronization.
165             </p>
166           <p>
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.
170             </p>
171         </div>
172         <div class="sect3" lang="en" xml:lang="en">
173           <div class="titlepage">
174             <div>
175               <div>
176                 <h4 class="title"><a id="idp827576"></a>EINVAL</h4>
177               </div>
178             </div>
179           </div>
180           <p>
181                 An invalid flag value or parameter was specified.
182             </p>
183         </div>
184       </div>
185       <div class="sect2" lang="en" xml:lang="en">
186         <div class="titlepage">
187           <div>
188             <div>
189               <h3 class="title"><a id="idp829848"></a>Class</h3>
190             </div>
191           </div>
192         </div>
193         <p>
194                 <a class="link" href="dbc.html" title="Chapter 3.  The Dbc Handle">Dbc</a>  
195             </p>
196       </div>
197       <div class="sect2" lang="en" xml:lang="en">
198         <div class="titlepage">
199           <div>
200             <div>
201               <h3 class="title"><a id="idp827056"></a>See Also</h3>
202             </div>
203           </div>
204         </div>
205         <p>
206                      <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> 
207                 </p>
208       </div>
209     </div>
210     <div class="navfooter">
211       <hr />
212       <table width="100%" summary="Navigation footer">
213         <tr>
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>
217           </td>
218           <td width="40%" align="right"> <a accesskey="n" href="dbcget.html">Next</a></td>
219         </tr>
220         <tr>
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>
224           </td>
225           <td width="40%" align="right" valign="top"> Dbc::get()</td>
226         </tr>
227       </table>
228     </div>
229   </body>
230 </html>