1<!--$Id: dbc_dup.so,v 10.34 2007/10/24 16:06:07 bostic 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: Dbc::dup</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>Dbc::dup</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 25Dbc::dup(Dbc **cursorp, u_int32_t flags); 26</pre></b> 27<hr size=1 noshade> 28<b>Description: Dbc::dup</b> 29<p>The Dbc::dup method creates a new cursor that uses the same transaction 30and locker ID as the original cursor. This is useful when an application 31is using locking and requires two or more cursors in the same thread of 32control.</p> 33<p>The Dbc::dup method 34either returns a non-zero error value 35or throws an exception that encapsulates a non-zero error value on 36failure, and returns 0 on success. 37</p> 38<b>Parameters</b> <br> 39 <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 40or more of the following values: 41<br> 42<b><a name="DB_POSITION">DB_POSITION</a></b><ul compact><li>The newly created cursor is initialized to refer to the same position 43in the database as the original cursor (if any) and hold the same locks 44(if any). If the DB_POSITION flag is not specified, or the 45original cursor does not hold a database position and locks, the created 46cursor is uninitialized and will behave like a cursor newly created 47using <a href="../api_cxx/db_cursor.html">Db::cursor</a>.</ul> 48<br></ul> 49<br> 50<br><b>Errors</b> 51<p>The Dbc::dup method 52may fail and throw 53<a href="../api_cxx/except_class.html">DbException</a>, 54encapsulating one of the following non-zero errors, or return one of 55the following non-zero errors:</p> 56<br> 57<b>DB_REP_HANDLE_DEAD</b><ul compact><li>The database handle has been invalidated because a replication election 58unrolled a committed transaction.</ul> 59<br> 60<br> 61<b>DB_REP_LOCKOUT</b><ul compact><li>The operation was blocked by client/master synchronization.</ul> 62<br> 63<br> 64<b>EINVAL</b><ul compact><li>An 65invalid flag value or parameter was specified.</ul> 66<br> 67<hr size=1 noshade> 68<br><b>Class</b> 69<a href="../api_cxx/dbc_class.html">Dbc</a> 70<br><b>See Also</b> 71<a href="../api_cxx/dbc_list.html">Database Cursors and Related Methods</a> 72</tt> 73<table width="100%"><tr><td><br></td><td align=right> 74<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> 75</td></tr></table> 76<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 77</body> 78</html> 79