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