PageRenderTime 28ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/source/db-5.0.26.NC/docs/api_reference/C/logcget.html

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