• 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>Dbc::count()</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="dbc.html" title="Chapter 3.  The Dbc Handle" />
11    <link rel="prev" href="dbccmp.html" title="Dbc::cmp()" />
12    <link rel="next" href="dbcdel.html" title="Dbc::del()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Dbc::count()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="dbccmp.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 3. 
23                The Dbc Handle
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="dbcdel.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="dbccount"></a>Dbc::count()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41Dbc::count(db_recno_t *countp, u_int32_t flags);</pre>
42      <p>
43         The <code class="methodname">Dbc::count()</code> method returns a count of the number of data
44         items for the key to which the cursor refers.
45    </p>
46      <p>
47         The <code class="methodname">Dbc::count()</code> <span>
48            
49            <span>
50                method either returns a non-zero error value or throws an
51                exception that encapsulates a non-zero error value on
52                failure, and returns 0 on success.
53            </span>
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="id1655201"></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="id1655322"></a>countp</h4>
69              </div>
70            </div>
71          </div>
72          <p>
73                          The <span class="bold"><strong>countp</strong></span> parameter references
74                          memory into which  the count of the number of duplicate data items is
75                          copied.
76                     </p>
77        </div>
78        <div class="sect3" lang="en" xml:lang="en">
79          <div class="titlepage">
80            <div>
81              <div>
82                <h4 class="title"><a id="id1655325"></a>flags</h4>
83              </div>
84            </div>
85          </div>
86          <p>
87                          The <span class="bold"><strong>flags</strong></span> parameter is currently
88                          unused, and must be set to 0.
89                     </p>
90        </div>
91      </div>
92      <div class="sect2" lang="en" xml:lang="en">
93        <div class="titlepage">
94          <div>
95            <div>
96              <h3 class="title"><a id="id1655461"></a>Errors</h3>
97            </div>
98          </div>
99        </div>
100        <p>
101                         The <code class="methodname">Dbc::count()</code> <span>
102            
103            <span>
104                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
105                exception, encapsulating one of the following non-zero errors, or return one
106                of the following non-zero errors:
107            </span>
108        </span>
109                    </p>
110        <div class="sect3" lang="en" xml:lang="en">
111          <div class="titlepage">
112            <div>
113              <div>
114                <h4 class="title"><a id="id1655445"></a><span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4>
115              </div>
116            </div>
117          </div>
118          <p>
119                When a client synchronizes with the master, it is possible for committed
120                transactions to be rolled back. This invalidates all  the database and cursor
121                handles opened in the replication environment. Once this occurs, an attempt to use
122                such a handle will 
123                <span>
124                    throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if
125                    your application is configured to throw exceptions), or 
126                </span>
127                return <code class="literal">DB_REP_HANDLE_DEAD</code>.
128                The application will need to discard the handle and open a new one in order to
129                continue processing.
130            </p>
131        </div>
132        <div class="sect3" lang="en" xml:lang="en">
133          <div class="titlepage">
134            <div>
135              <div>
136                <h4 class="title"><a id="id1655523"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4>
137              </div>
138            </div>
139          </div>
140          <p>
141                The operation was blocked by client/master synchronization.
142            </p>
143          <p>
144                <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
145                your Berkeley DB API is configured to throw exceptions.
146                Otherwise, <code class="literal">DB_REP_LOCKOUT</code> is returned.
147            </p>
148        </div>
149        <div class="sect3" lang="en" xml:lang="en">
150          <div class="titlepage">
151            <div>
152              <div>
153                <h4 class="title"><a id="id1655556"></a>EINVAL</h4>
154              </div>
155            </div>
156          </div>
157          <p>
158                If the cursor has not been initialized; or if an invalid flag value or parameter was specified.
159            </p>
160        </div>
161      </div>
162      <div class="sect2" lang="en" xml:lang="en">
163        <div class="titlepage">
164          <div>
165            <div>
166              <h3 class="title"><a id="id1655530"></a>Class</h3>
167            </div>
168          </div>
169        </div>
170        <p>
171                     <a class="link" href="dbc.html" title="Chapter 3.  The Dbc Handle">Dbc</a>  
172            </p>
173      </div>
174      <div class="sect2" lang="en" xml:lang="en">
175        <div class="titlepage">
176          <div>
177            <div>
178              <h3 class="title"><a id="id1655294"></a>See Also</h3>
179            </div>
180          </div>
181        </div>
182        <p>
183                     <a class="xref" href="dbc.html#dbclist" title="Database Cursors and Related Methods">Database Cursors and Related Methods</a> 
184                </p>
185      </div>
186    </div>
187    <div class="navfooter">
188      <hr />
189      <table width="100%" summary="Navigation footer">
190        <tr>
191          <td width="40%" align="left"><a accesskey="p" href="dbccmp.html">Prev</a> </td>
192          <td width="20%" align="center">
193            <a accesskey="u" href="dbc.html">Up</a>
194          </td>
195          <td width="40%" align="right"> <a accesskey="n" href="dbcdel.html">Next</a></td>
196        </tr>
197        <tr>
198          <td width="40%" align="left" valign="top">Dbc::cmp() </td>
199          <td width="20%" align="center">
200            <a accesskey="h" href="index.html">Home</a>
201          </td>
202          <td width="40%" align="right" valign="top"> Dbc::del()</td>
203        </tr>
204      </table>
205    </div>
206  </body>
207</html>
208