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