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