• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/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-&gt;exists()</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="db.html" title="Chapter��2.�� The DB Handle" />
11    <link rel="prev" href="dberr.html" title="DB-&gt;err()" />
12    <link rel="next" href="dbfd.html" title="DB-&gt;fd()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB-&gt;exists()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="dberr.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��2.��
23                The DB Handle
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="dbfd.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="dbexists"></a>DB-&gt;exists()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB-&gt;exists(DB *db, DB_TXN *txnid, DBT *key, u_int32_t flags);  </pre>
42      <p>
43         The <code class="methodname">DB-&gt;exists()</code> method returns whether the specified key appears in the
44         database.
45    </p>
46      <p>
47         The <code class="methodname">DB-&gt;exists()</code> method will return <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a> if the specified key
48         is not in the database. The <code class="methodname">DB-&gt;exists()</code> method will return
49         <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_KEYEMPTY" class="olink">DB_KEYEMPTY</a> if the database
50         is a Queue or Recno database and the specified key exists, but was never explicitly created
51         by the application or was later deleted. 
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="id1634166"></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="id1634245"></a>flags</h4>
66              </div>
67            </div>
68          </div>
69          <p>
70                The <span class="bold"><strong>flags</strong></span> parameter must be set to zero or
71                by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together one
72                or more of the following values:
73            </p>
74          <div class="itemizedlist">
75            <ul type="disc">
76              <li>
77                <p><a id="exists_DB_READ_COMMITTED"></a>
78                    <code class="literal">DB_READ_COMMITTED</code>
79                </p>
80                <p>
81                    Configure a transactional read operation to have degree 2 isolation
82                    (the read is not repeatable).
83                </p>
84              </li>
85              <li>
86                <p><a id="exists_DB_READ_UNCOMMITTED"></a>
87                    <code class="literal">DB_READ_UNCOMMITTED</code>
88                </p>
89                <p>
90                    Configure a transactional read operation to have degree 1 isolation,
91                    reading modified but not yet committed data.  Silently ignored if the
92                    <a class="link" href="dbopen.html#dbopen_DB_READ_UNCOMMITTED">DB_READ_UNCOMMITTED</a> 
93                    flag was not specified when the underlying database was opened.
94                </p>
95              </li>
96              <li>
97                <p><a id="exists_DB_RMW"></a>
98                    <code class="literal">DB_RMW</code>
99                </p>
100                <p>
101                    Acquire write locks instead of read locks when doing the read, if locking is
102                    configured.  Setting this flag can eliminate deadlock during a read-modify-write
103                    cycle by acquiring the write lock during the read part of the cycle so that
104                    another thread of control acquiring a read lock for the same item, in its own
105                    read-modify-write cycle, will not result in deadlock.
106                </p>
107                <p>
108                    Because the <code class="methodname">DB-&gt;exists()</code> method will not hold locks
109                    across Berkeley DB calls in non-transactional operations, the 
110                    <a class="link" href="dbcget.html#dbcget_DB_RMW">DB_RMW</a>  flag to the
111                    <code class="methodname">DB-&gt;exists()</code> call is meaningful only in the presence
112                    of transactions.
113                </p>
114              </li>
115            </ul>
116          </div>
117        </div>
118        <div class="sect3" lang="en" xml:lang="en">
119          <div class="titlepage">
120            <div>
121              <div>
122                <h4 class="title"><a id="id1634337"></a>key</h4>
123              </div>
124            </div>
125          </div>
126          <p>
127                The key <a class="link" href="dbt.html" title="Chapter��4.�� The DBT Handle">DBT</a>  operated on.
128            </p>
129        </div>
130        <div class="sect3" lang="en" xml:lang="en">
131          <div class="titlepage">
132            <div>
133              <div>
134                <h4 class="title"><a id="id1634420"></a>txnid</h4>
135              </div>
136            </div>
137          </div>
138          <p>
139                If the operation is part of an application-specified transaction, the <span class="bold"><strong>txnid</strong></span> parameter is a transaction handle returned from
140                <a class="xref" href="txnbegin.html" title="DB_ENV-&gt;txn_begin()">DB_ENV-&gt;txn_begin()</a>; if the operation is part of a
141                Berkeley DB Concurrent Data Store group, the <span class="bold"><strong>txnid</strong></span>
142                parameter is a handle returned from 
143                <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV-&gt;cdsgroup_begin()">DB_ENV-&gt;cdsgroup_begin()</a>; otherwise NULL.  
144                If no transaction handle is specified, but the
145                operation occurs in a transactional database, the operation will be
146                implicitly transaction protected.
147            </p>
148        </div>
149      </div>
150      <div class="sect2" lang="en" xml:lang="en">
151        <div class="titlepage">
152          <div>
153            <div>
154              <h3 class="title"><a id="id1634561"></a>Class</h3>
155            </div>
156          </div>
157        </div>
158        <p>
159            <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a>  
160        </p>
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="id1634410"></a>See Also</h3>
167            </div>
168          </div>
169        </div>
170        <p>
171            <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
172        </p>
173      </div>
174    </div>
175    <div class="navfooter">
176      <hr />
177      <table width="100%" summary="Navigation footer">
178        <tr>
179          <td width="40%" align="left"><a accesskey="p" href="dberr.html">Prev</a>��</td>
180          <td width="20%" align="center">
181            <a accesskey="u" href="db.html">Up</a>
182          </td>
183          <td width="40%" align="right">��<a accesskey="n" href="dbfd.html">Next</a></td>
184        </tr>
185        <tr>
186          <td width="40%" align="left" valign="top">DB-&gt;err()��</td>
187          <td width="20%" align="center">
188            <a accesskey="h" href="index.html">Home</a>
189          </td>
190          <td width="40%" align="right" valign="top">��DB-&gt;fd()</td>
191        </tr>
192      </table>
193    </div>
194  </body>
195</html>
196