| 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>DBcursor->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 DBcursor Handle" /> |
| 11 | <link rel="prev" href="dbcdel.html" title="DBcursor->del()" /> |
| 12 | <link rel="next" href="dbcget.html" title="DBcursor->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">DBcursor->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 DBcursor 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>DBcursor->dup()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DBcursor->dup(DBC *DBcursor, DBC **cursorp, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DBcursor->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">DBcursor->dup()</code> <span> |
| 53 | <span> |
| 54 | method returns a non-zero error value on failure and 0 on success. |
| 55 | </span> |
| 56 | |
| 57 | </span> |
| 58 | </p> |
| 59 | <div class="sect2" lang="en" xml:lang="en"> |
| 60 | <div class="titlepage"> |
| 61 | <div> |
| 62 | <div> |
| 63 | <h3 class="title"><a id="idp50871680"></a>Parameters</h3> |
| 64 | </div> |
| 65 | </div> |
| 66 | </div> |
| 67 | <div class="sect3" lang="en" xml:lang="en"> |
| 68 | <div class="titlepage"> |
| 69 | <div> |
| 70 | <div> |
| 71 | <h4 class="title"><a id="idp50860816"></a>cursorp</h4> |
| 72 | </div> |
| 73 | </div> |
| 74 | </div> |
| 75 | <p> |
| 76 | The <code class="methodname">DBcursor->dup()</code> method |
| 77 | returns the newly created cursor in |
| 78 | <span class="bold"><strong>cursorp</strong></span>. |
| 79 | </p> |
| 80 | </div> |
| 81 | <div class="sect3" lang="en" xml:lang="en"> |
| 82 | <div class="titlepage"> |
| 83 | <div> |
| 84 | <div> |
| 85 | <h4 class="title"><a id="idp50863544"></a>flags</h4> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | <p> |
| 90 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 91 | or the following flag: |
| 92 | </p> |
| 93 | <div class="itemizedlist"> |
| 94 | <ul type="disc"> |
| 95 | <li> |
| 96 | <p><a id="dup_DB_POSITION"></a> |
| 97 | <code class="literal">DB_POSITION</code> |
| 98 | </p> |
| 99 | <p> |
| 100 | The newly created cursor is initialized to refer to the same position |
| 101 | in the database as the original cursor (if any) and hold the same |
| 102 | locks (if any). If the DB_POSITION flag is not specified, or the |
| 103 | original cursor does not hold a database position and locks, the |
| 104 | created cursor is uninitialized and will behave like a cursor newly |
| 105 | created using the <a class="xref" href="dbcursor.html" title="DB->cursor()">DB->cursor()</a> |
| 106 | method. |
| 107 | </p> |
| 108 | </li> |
| 109 | </ul> |
| 110 | </div> |
| 111 | </div> |
| 112 | </div> |
| 113 | <div class="sect2" lang="en" xml:lang="en"> |
| 114 | <div class="titlepage"> |
| 115 | <div> |
| 116 | <div> |
| 117 | <h3 class="title"><a id="idp50882232"></a>Errors</h3> |
| 118 | </div> |
| 119 | </div> |
| 120 | </div> |
| 121 | <p> |
| 122 | The <code class="methodname">DBcursor->dup()</code> <span> |
| 123 | <span> |
| 124 | method may fail and return one of the following non-zero errors: |
| 125 | </span> |
| 126 | |
| 127 | </span> |
| 128 | </p> |
| 129 | <div class="sect3" lang="en" xml:lang="en"> |
| 130 | <div class="titlepage"> |
| 131 | <div> |
| 132 | <div> |
| 133 | <h4 class="title"><a id="idp50859600"></a> DB_REP_HANDLE_DEAD</h4> |
| 134 | </div> |
| 135 | </div> |
| 136 | </div> |
| 137 | <p> |
| 138 | When a client synchronizes with the master, it is possible for committed |
| 139 | transactions to be rolled back. This invalidates all the database and cursor |
| 140 | handles opened in the replication environment. Once this occurs, an attempt to use |
| 141 | such a handle will |
| 142 | |
| 143 | return <code class="literal">DB_REP_HANDLE_DEAD</code>. |
| 144 | The application will need to discard the handle and open a new one in order to |
| 145 | continue processing. |
| 146 | </p> |
| 147 | </div> |
| 148 | <div class="sect3" lang="en" xml:lang="en"> |
| 149 | <div class="titlepage"> |
| 150 | <div> |
| 151 | <div> |
| 152 | <h4 class="title"><a id="idp50888080"></a>DB_REP_LOCKOUT</h4> |
| 153 | </div> |
| 154 | </div> |
| 155 | </div> |
| 156 | <p> |
| 157 | The operation was blocked by client/master synchronization. |
| 158 | </p> |
| 159 | </div> |
| 160 | <div class="sect3" lang="en" xml:lang="en"> |
| 161 | <div class="titlepage"> |
| 162 | <div> |
| 163 | <div> |
| 164 | <h4 class="title"><a id="idp50832616"></a>EINVAL</h4> |
| 165 | </div> |
| 166 | </div> |
| 167 | </div> |
| 168 | <p> |
| 169 | An invalid flag value or parameter was specified. |
| 170 | </p> |
| 171 | </div> |
| 172 | </div> |
| 173 | <div class="sect2" lang="en" xml:lang="en"> |
| 174 | <div class="titlepage"> |
| 175 | <div> |
| 176 | <div> |
| 177 | <h3 class="title"><a id="idp50885920"></a>Class</h3> |
| 178 | </div> |
| 179 | </div> |
| 180 | </div> |
| 181 | <p> |
| 182 | <a class="link" href="dbc.html" title="Chapter 3. The DBcursor Handle">DBcursor</a> |
| 183 | </p> |
| 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="idp50889408"></a>See Also</h3> |
| 190 | </div> |
| 191 | </div> |
| 192 | </div> |
| 193 | <p> |
| 194 | <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> |
| 195 | </p> |
| 196 | </div> |
| 197 | </div> |
| 198 | <div class="navfooter"> |
| 199 | <hr /> |
| 200 | <table width="100%" summary="Navigation footer"> |
| 201 | <tr> |
| 202 | <td width="40%" align="left"><a accesskey="p" href="dbcdel.html">Prev</a> </td> |
| 203 | <td width="20%" align="center"> |
| 204 | <a accesskey="u" href="dbc.html">Up</a> |
| 205 | </td> |
| 206 | <td width="40%" align="right"> <a accesskey="n" href="dbcget.html">Next</a></td> |
| 207 | </tr> |
| 208 | <tr> |
| 209 | <td width="40%" align="left" valign="top">DBcursor->del() </td> |
| 210 | <td width="20%" align="center"> |
| 211 | <a accesskey="h" href="index.html">Home</a> |
| 212 | </td> |
| 213 | <td width="40%" align="right" valign="top"> DBcursor->get()</td> |
| 214 | </tr> |
| 215 | </table> |
| 216 | </div> |
| 217 | </body> |
| 218 | </html> |