| 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>DbLogc::get()</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="lsn.html" title="Chapter 8. The DbLsn Handle" /> |
| 11 | <link rel="prev" href="logcclose.html" title="DbLogc::close()" /> |
| 12 | <link rel="next" href="logcompare.html" title="DbEnv::log_compare()" /> |
| 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">DbLogc::get()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="logcclose.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 8. |
| 26 | The DbLsn Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="logcompare.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="logcget"></a>DbLogc::get()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbLogc::get(DbLsn *lsn, Dbt *data, u_int32_t flags);</pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbLogc::get()</code> method returns records from the log. |
| 47 | </p> |
| 48 | <p> |
| 49 | Unless otherwise specified, the <code class="methodname">DbLogc::get()</code> <span> |
| 50 | |
| 51 | <span> |
| 52 | method either returns a non-zero error value or throws an |
| 53 | exception that encapsulates a non-zero error value on |
| 54 | failure, and returns 0 on success. |
| 55 | </span> |
| 56 | </span> |
| 57 | </p> |
| 58 | <div class="sect2" lang="en" xml:lang="en"> |
| 59 | <div class="titlepage"> |
| 60 | <div> |
| 61 | <div> |
| 62 | <h3 class="title"><a id="idp8546272"></a>Parameters</h3> |
| 63 | </div> |
| 64 | </div> |
| 65 | </div> |
| 66 | <div class="sect3" lang="en" xml:lang="en"> |
| 67 | <div class="titlepage"> |
| 68 | <div> |
| 69 | <div> |
| 70 | <h4 class="title"><a id="idp8545624"></a>lsn</h4> |
| 71 | </div> |
| 72 | </div> |
| 73 | </div> |
| 74 | <p> |
| 75 | When the <span class="bold"><strong>flag</strong></span> parameter is set to |
| 76 | DB_CURRENT, DB_FIRST, DB_LAST, DB_NEXT or DB_PREV, the <span class="bold"><strong>lsn</strong></span> parameter is overwritten with the |
| 77 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> value of the record |
| 78 | retrieved. When <span class="bold"><strong>flag</strong></span> is set to |
| 79 | DB_SET, the <span class="bold"><strong>lsn</strong></span> parameter is the |
| 80 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> value of the |
| 81 | record to be retrieved. |
| 82 | </p> |
| 83 | </div> |
| 84 | <div class="sect3" lang="en" xml:lang="en"> |
| 85 | <div class="titlepage"> |
| 86 | <div> |
| 87 | <div> |
| 88 | <h4 class="title"><a id="idp8550328"></a>data</h4> |
| 89 | </div> |
| 90 | </div> |
| 91 | </div> |
| 92 | <p> |
| 93 | The data field of the <span class="bold"><strong>data</strong></span> structure |
| 94 | is set to the record retrieved, and the size field indicates the |
| 95 | number of bytes in the record. See |
| 96 | <a class="link" href="dbt.html" title="Chapter 4. The Dbt Handle">Dbt</a> for a description of other |
| 97 | fields in the <span class="bold"><strong>data</strong></span> structure. The |
| 98 | <a class="link" href="dbt.html#dbt_DB_DBT_MALLOC">DB_DBT_MALLOC</a>, |
| 99 | <a class="link" href="dbt.html#dbt_DB_DBT_REALLOC">DB_DBT_REALLOC</a> |
| 100 | and <a class="link" href="dbt.html#dbt_DB_DBT_USERMEM">DB_DBT_USERMEM</a> |
| 101 | flags may be specified for any |
| 102 | <a class="link" href="dbt.html" title="Chapter 4. The Dbt Handle">Dbt</a> used for data retrieval. |
| 103 | </p> |
| 104 | </div> |
| 105 | <div class="sect3" lang="en" xml:lang="en"> |
| 106 | <div class="titlepage"> |
| 107 | <div> |
| 108 | <div> |
| 109 | <h4 class="title"><a id="idp8539952"></a>flags</h4> |
| 110 | </div> |
| 111 | </div> |
| 112 | </div> |
| 113 | <p> |
| 114 | The <span class="bold"><strong>flags</strong></span> parameter must be set to |
| 115 | one of the following values: |
| 116 | </p> |
| 117 | <div class="itemizedlist"> |
| 118 | <ul type="disc"> |
| 119 | <li> |
| 120 | <p><a id="get_DB_CURRENT"></a> |
| 121 | <code class="literal">DB_CURRENT</code> |
| 122 | </p> |
| 123 | <p> |
| 124 | Return the log record to which the log currently refers. |
| 125 | </p> |
| 126 | </li> |
| 127 | <li> |
| 128 | <p><a id="get_DB_FIRST"></a> |
| 129 | <code class="literal">DB_FIRST</code> |
| 130 | </p> |
| 131 | <p> |
| 132 | The first record from any of the log files found in the log directory |
| 133 | is returned in the <span class="bold"><strong>data</strong></span> parameter. |
| 134 | The <span class="bold"><strong>lsn</strong></span> parameter is overwritten with |
| 135 | the <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the record |
| 136 | returned. |
| 137 | </p> |
| 138 | <p> |
| 139 | The <code class="methodname">DbLogc::get()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a> if |
| 140 | DB_FIRST is set and the log is empty. |
| 141 | </p> |
| 142 | </li> |
| 143 | <li> |
| 144 | <p><a id="get_DB_LAST"></a> |
| 145 | <code class="literal">DB_LAST</code> |
| 146 | </p> |
| 147 | <p> |
| 148 | The last record in the log is returned in the <span class="bold"><strong>data</strong></span> parameter. The <span class="bold"><strong>lsn</strong></span> parameter is overwritten with the |
| 149 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the record returned. |
| 150 | </p> |
| 151 | <p> |
| 152 | The <code class="methodname">DbLogc::get()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a> if |
| 153 | DB_LAST is set and the log is empty. |
| 154 | </p> |
| 155 | </li> |
| 156 | <li> |
| 157 | <p><a id="get_DB_NEXT"></a> |
| 158 | <code class="literal">DB_NEXT</code> |
| 159 | </p> |
| 160 | <p> |
| 161 | The current log position is advanced to the next record in the log, |
| 162 | and that record is returned in the <span class="bold"><strong>data</strong></span> parameter. The <span class="bold"><strong>lsn</strong></span> parameter is overwritten with the |
| 163 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the record returned. |
| 164 | </p> |
| 165 | <p> |
| 166 | If the cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET, |
| 167 | DB_NEXT, or DB_PREV, <code class="methodname">DbLogc::get()</code> will return the first record in |
| 168 | the log. |
| 169 | </p> |
| 170 | <p> |
| 171 | The <code class="methodname">DbLogc::get()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a> if |
| 172 | DB_NEXT is set and the last log record has already been returned or |
| 173 | the log is empty. |
| 174 | </p> |
| 175 | </li> |
| 176 | <li> |
| 177 | <p><a id="get_DB_PREV"></a> |
| 178 | <code class="literal">DB_PREV</code> |
| 179 | </p> |
| 180 | <p> |
| 181 | The current log position is advanced to the previous record in the |
| 182 | log, and that record is returned in the <span class="bold"><strong>data</strong></span> parameter. The <span class="bold"><strong>lsn</strong></span> parameter is overwritten with the |
| 183 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the record returned. |
| 184 | </p> |
| 185 | <p> |
| 186 | If the cursor has not been initialized via DB_FIRST, DB_LAST, DB_SET, |
| 187 | DB_NEXT, or DB_PREV, <code class="methodname">DbLogc::get()</code> will return the last record in |
| 188 | the log. |
| 189 | </p> |
| 190 | <p> |
| 191 | The <code class="methodname">DbLogc::get()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a> if |
| 192 | DB_PREV is set and the first log record has already been returned or |
| 193 | the log is empty. |
| 194 | </p> |
| 195 | </li> |
| 196 | <li> |
| 197 | <p><a id="get_DB_SET"></a> |
| 198 | <code class="literal">DB_SET</code> |
| 199 | </p> |
| 200 | <p> |
| 201 | Retrieve the record specified by the <span class="bold"><strong>lsn</strong></span> parameter. |
| 202 | </p> |
| 203 | </li> |
| 204 | </ul> |
| 205 | </div> |
| 206 | </div> |
| 207 | </div> |
| 208 | <div class="sect2" lang="en" xml:lang="en"> |
| 209 | <div class="titlepage"> |
| 210 | <div> |
| 211 | <div> |
| 212 | <h3 class="title"><a id="idp8563672"></a>Errors</h3> |
| 213 | </div> |
| 214 | </div> |
| 215 | </div> |
| 216 | <p> |
| 217 | The <code class="methodname">DbLogc::get()</code> <span> |
| 218 | |
| 219 | <span> |
| 220 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 221 | exception, encapsulating one of the following non-zero errors, or return one |
| 222 | of the following non-zero errors: |
| 223 | </span> |
| 224 | </span> |
| 225 | </p> |
| 226 | <div class="sect3" lang="en" xml:lang="en"> |
| 227 | <div class="titlepage"> |
| 228 | <div> |
| 229 | <div> |
| 230 | <h4 class="title"><a id="idp8552848"></a>EINVAL</h4> |
| 231 | </div> |
| 232 | </div> |
| 233 | </div> |
| 234 | <p> |
| 235 | If the DB_CURRENT flag was set and the log cursor has not yet been |
| 236 | initialized; the DB_CURRENT, DB_NEXT, or DB_PREV flags were set and |
| 237 | the log was opened with the DB_THREAD flag set; the DB_SET flag was |
| 238 | set and the specified log sequence number does not appear in the log; |
| 239 | or if an invalid flag value or parameter was specified. |
| 240 | </p> |
| 241 | </div> |
| 242 | </div> |
| 243 | <div class="sect2" lang="en" xml:lang="en"> |
| 244 | <div class="titlepage"> |
| 245 | <div> |
| 246 | <div> |
| 247 | <h3 class="title"><a id="idp8567160"></a>Class</h3> |
| 248 | </div> |
| 249 | </div> |
| 250 | </div> |
| 251 | <p> |
| 252 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, |
| 253 | <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, |
| 254 | <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> |
| 255 | </p> |
| 256 | </div> |
| 257 | <div class="sect2" lang="en" xml:lang="en"> |
| 258 | <div class="titlepage"> |
| 259 | <div> |
| 260 | <div> |
| 261 | <h3 class="title"><a id="idp8561728"></a>See Also</h3> |
| 262 | </div> |
| 263 | </div> |
| 264 | </div> |
| 265 | <p> |
| 266 | <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> |
| 267 | </p> |
| 268 | </div> |
| 269 | </div> |
| 270 | <div class="navfooter"> |
| 271 | <hr /> |
| 272 | <table width="100%" summary="Navigation footer"> |
| 273 | <tr> |
| 274 | <td width="40%" align="left"><a accesskey="p" href="logcclose.html">Prev</a> </td> |
| 275 | <td width="20%" align="center"> |
| 276 | <a accesskey="u" href="lsn.html">Up</a> |
| 277 | </td> |
| 278 | <td width="40%" align="right"> <a accesskey="n" href="logcompare.html">Next</a></td> |
| 279 | </tr> |
| 280 | <tr> |
| 281 | <td width="40%" align="left" valign="top">DbLogc::close() </td> |
| 282 | <td width="20%" align="center"> |
| 283 | <a accesskey="h" href="index.html">Home</a> |
| 284 | </td> |
| 285 | <td width="40%" align="right" valign="top"> DbEnv::log_compare()</td> |
| 286 | </tr> |
| 287 | </table> |
| 288 | </div> |
| 289 | </body> |
| 290 | </html> |