• 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_create</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="dbclose.html" title="DB-&gt;close()" />
12    <link rel="next" href="dbcompact.html" title="DB-&gt;compact()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">db_create</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="dbclose.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="dbcompact.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="dbcreate"></a>db_create</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int db_create(DB **dbp, DB_ENV *dbenv, u_int32_t flags);  </pre>
41      <p>
42        The <code class="function">db_create()</code> function creates a <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a> 
43        structure that is the handle for a Berkeley DB database. This function allocates memory for the
44        structure, returning a pointer to the structure in the memory to which 
45        <span class="bold"><strong>dbp</strong></span> refers.  To release the allocated memory and 
46        discard the handle, call the <a class="xref" href="dbclose.html" title="DB-&gt;close()">DB-&gt;close()</a>, 
47        <a class="xref" href="dbremove.html" title="DB-&gt;remove()">DB-&gt;remove()</a>, 
48        <a class="xref" href="dbrename.html" title="DB-&gt;rename()">DB-&gt;rename()</a>, or 
49        <a class="xref" href="dbverify.html" title="DB-&gt;verify()">DB-&gt;verify()</a> methods.
50    </p>
51      <p>
52        DB handles are free-threaded if the 
53        <a class="link" href="envopen.html#envopen_DB_THREAD">DB_THREAD</a> flag is specified to 
54        the <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method when the database is opened or 
55        if the database environment in which the database is opened is free-threaded. The handle 
56        should not be closed while any other handle that refers to the database is in use; for 
57        example, database handles must not be closed while cursor handles into the database remain 
58        open, or transactions that include operations on the database have not yet been committed 
59        or aborted.  Once the <a class="xref" href="dbclose.html" title="DB-&gt;close()">DB-&gt;close()</a>, 
60        <a class="xref" href="dbremove.html" title="DB-&gt;remove()">DB-&gt;remove()</a>, 
61        <a class="xref" href="dbrename.html" title="DB-&gt;rename()">DB-&gt;rename()</a>, or
62        <a class="xref" href="dbverify.html" title="DB-&gt;verify()">DB-&gt;verify()</a> 
63        methods are called, the handle may not be accessed again, regardless of the method's return.
64    </p>
65      <p>
66        The DB handle contains a special field, <code class="literal">app_private</code>, 
67        which is declared as type <code class="literal">void *</code>. This field is provided for the use
68        of the application program. It is initialized to NULL and is not further used by 
69        Berkeley DB in any way.
70    </p>
71      <p>
72        The <code class="literal">db_create</code> function returns a non-zero error value on failure
73        and 0 on success.
74    </p>
75      <div class="sect2" lang="en" xml:lang="en">
76        <div class="titlepage">
77          <div>
78            <div>
79              <h3 class="title"><a id="id1632467"></a>Parameters</h3>
80            </div>
81          </div>
82        </div>
83        <div class="sect3" lang="en" xml:lang="en">
84          <div class="titlepage">
85            <div>
86              <div>
87                <h4 class="title"><a id="id1632665"></a>dbp</h4>
88              </div>
89            </div>
90          </div>
91          <p>
92                The <span class="bold"><strong>dbp</strong></span> parameter references the
93                memory into which the returned structure pointer is stored.
94            </p>
95        </div>
96        <div class="sect3" lang="en" xml:lang="en">
97          <div class="titlepage">
98            <div>
99              <div>
100                <h4 class="title"><a id="id1632600"></a>dbenv</h4>
101              </div>
102            </div>
103          </div>
104          <p>
105                <span>If the <span class="bold"><strong>dbenv</strong></span> parameter is NULL,</span> 
106                 
107                the database is standalone; that is, it is not part of any Berkeley DB
108                environment.
109            </p>
110          <p>
111                <span>
112                    If the <span class="bold"><strong>dbenv</strong></span> parameter is not NULL,
113                </span>
114                
115                the database is created within the specified Berkeley DB environment. 
116                The database access methods automatically make calls to the other
117                subsystems in Berkeley DB, based on the enclosing environment.  For
118                example, if the environment has been configured to use locking, the
119                access methods will automatically acquire the correct locks when
120                reading and writing pages of the database.
121            </p>
122        </div>
123        <div class="sect3" lang="en" xml:lang="en">
124          <div class="titlepage">
125            <div>
126              <div>
127                <h4 class="title"><a id="id1632578"></a>flags</h4>
128              </div>
129            </div>
130          </div>
131          <p>
132                  The <span class="bold"><strong>flags</strong></span> parameter is currently
133                  unused, and must be set to 0.
134             </p>
135          <div class="itemizedlist">
136            <ul type="disc"></ul>
137          </div>
138        </div>
139      </div>
140      <div class="sect2" lang="en" xml:lang="en">
141        <div class="titlepage">
142          <div>
143            <div>
144              <h3 class="title"><a id="id1632748"></a>Errors</h3>
145            </div>
146          </div>
147        </div>
148        <p>
149                        The <code class="function">db_create()</code> function may fail and return one of the following non-zero
150                         errors:
151                    </p>
152        <div class="sect3" lang="en" xml:lang="en">
153          <div class="titlepage">
154            <div>
155              <div>
156                <h4 class="title"><a id="id1632410"></a>EINVAL</h4>
157              </div>
158            </div>
159          </div>
160          <p>
161                An invalid flag value or parameter was specified.
162            </p>
163        </div>
164      </div>
165      <div class="sect2" lang="en" xml:lang="en">
166        <div class="titlepage">
167          <div>
168            <div>
169              <h3 class="title"><a id="id1632411"></a>Class</h3>
170            </div>
171          </div>
172        </div>
173        <p>
174            <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a>
175        </p>
176      </div>
177      <div class="sect2" lang="en" xml:lang="en">
178        <div class="titlepage">
179          <div>
180            <div>
181              <h3 class="title"><a id="id1632381"></a>See Also</h3>
182            </div>
183          </div>
184        </div>
185        <p>
186            <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
187        </p>
188      </div>
189    </div>
190    <div class="navfooter">
191      <hr />
192      <table width="100%" summary="Navigation footer">
193        <tr>
194          <td width="40%" align="left"><a accesskey="p" href="dbclose.html">Prev</a>��</td>
195          <td width="20%" align="center">
196            <a accesskey="u" href="db.html">Up</a>
197          </td>
198          <td width="40%" align="right">��<a accesskey="n" href="dbcompact.html">Next</a></td>
199        </tr>
200        <tr>
201          <td width="40%" align="left" valign="top">DB-&gt;close()��</td>
202          <td width="20%" align="center">
203            <a accesskey="h" href="index.html">Home</a>
204          </td>
205          <td width="40%" align="right" valign="top">��DB-&gt;compact()</td>
206        </tr>
207      </table>
208    </div>
209  </body>
210</html>
211