Debian Codegraph @

docs/api_reference/C/dbset_append_recno.html

raw symbols SCIP
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;set_append_recno()</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="dbset_alloc.html" title="DB-&gt;set_alloc()" />
12 <link rel="next" href="dbset_bt_compare.html" title="DB-&gt;set_bt_compare()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DB-&gt;set_append_recno()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbset_alloc.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 2. 
26 The DB Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="dbset_bt_compare.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="dbset_append_recno"></a>DB-&gt;set_append_recno()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB-&gt;set_append_recno(DB *,
45 int (*db_append_recno_fcn)(DB *dbp, DBT *data, db_recno_t recno)); </pre>
46 <p>
47 When using the <a class="link" href="dbput.html#dbput_DB_APPEND">DB_APPEND</a>
48 option of the <a class="xref" href="dbput.html" title="DB-&gt;put()">DB-&gt;put()</a> method, it may be
49 useful to modify the stored data based on the generated key. If a
50 callback function is specified using the
51 <code class="methodname">DB-&gt;set_append_recno()</code>
52 method, it will be called after the record number has been selected,
53 but before the data has been stored.
54 </p>
55 <p>
56 The <code class="methodname">DB-&gt;set_append_recno()</code> method configures operations performed
57 using the specified <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
58 handle, not all operations performed on the underlying database.
59 </p>
60 <p>
61 The <code class="methodname">DB-&gt;set_append_recno()</code> method may not be called after the
62 <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method is called.
63 </p>
64 <p>
65 The <code class="methodname">DB-&gt;set_append_recno()</code> <span>
66 <span>
67 method returns a non-zero error value on failure and 0 on success.
68 </span>
69
70 </span>
71 </p>
72 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
73 <h3 class="title">Note</h3>
74 <p>
75 Berkeley DB is not re-entrant. Callback functions should not attempt to make
76 library calls (for example, to release locks or close open handles). Re-entering
77 Berkeley DB is not guaranteed to work correctly, and the results are undefined.
78 </p>
79 </div>
80 <div class="sect2" lang="en" xml:lang="en">
81 <div class="titlepage">
82 <div>
83 <div>
84 <h3 class="title"><a id="idp50061832"></a>Parameters</h3>
85 </div>
86 </div>
87 </div>
88 <div class="sect3" lang="en" xml:lang="en">
89 <div class="titlepage">
90 <div>
91 <div>
92 <h4 class="title"><a id="idp50061336"></a>db_append_recno_fcn</h4>
93 </div>
94 </div>
95 </div>
96 <p>
97 The <span class="bold"><strong>db_append_recno_fcn</strong></span> parameter is
98 a function to call after the record number has been selected but
99 before the data has been stored into the database. The function takes
100 three parameters:
101 </p>
102 <div class="itemizedlist">
103 <ul type="disc">
104 <li>
105 <p>
106 <code class="literal">dbp</code>
107 </p>
108 <p>
109 The <span class="bold"><strong>dbp</strong></span> parameter is the enclosing
110 database handle.
111 </p>
112 </li>
113 <li>
114 <p>
115 <code class="literal">data</code>
116 </p>
117 <p>
118 The <span class="bold"><strong>data</strong></span> parameter is the data
119 <a class="link" href="dbt.html" title="Chapter 4.  The DBT Handle">DBT</a> to be stored.
120 </p>
121 </li>
122 <li>
123 <p>
124 <code class="literal">recno</code>
125 </p>
126 <p>
127 The <span class="bold"><strong>recno</strong></span> parameter is the generated
128 record number.
129 </p>
130 </li>
131 </ul>
132 </div>
133 <p>
134 The called function may modify the data
135 <a class="link" href="dbt.html" title="Chapter 4.  The DBT Handle">DBT</a>. If the function needs to allocate
136 memory for the <span class="bold"><strong>data</strong></span> field, the
137 <span class="bold"><strong>flags</strong></span> field of
138 the returned <a class="link" href="dbt.html" title="Chapter 4.  The DBT Handle">DBT</a>
139 should be set to <code class="literal">DB_DBT_APPMALLOC</code>, which indicates that
140 Berkeley DB should free the memory when it is done with it.
141 </p>
142 <p>
143 The callback function must return 0 on success and
144 <span class="bold"><strong>errno</strong></span> or a value outside of
145 the Berkeley DB error name space on failure.
146 </p>
147 </div>
148 </div>
149 <div class="sect2" lang="en" xml:lang="en">
150 <div class="titlepage">
151 <div>
152 <div>
153 <h3 class="title"><a id="idp50072048"></a>Errors</h3>
154 </div>
155 </div>
156 </div>
157 <p>
158 The <code class="methodname">DB-&gt;set_append_recno()</code> <span>
159 <span>
160 method may fail and return one of the following non-zero errors:
161 </span>
162
163 </span>
164 </p>
165 <div class="sect3" lang="en" xml:lang="en">
166 <div class="titlepage">
167 <div>
168 <div>
169 <h4 class="title"><a id="idp50072496"></a>EINVAL</h4>
170 </div>
171 </div>
172 </div>
173 <p>
174 If the method was called after <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a>
175 was called; or if an invalid flag value or parameter was specified.
176 </p>
177 </div>
178 </div>
179 <div class="sect2" lang="en" xml:lang="en">
180 <div class="titlepage">
181 <div>
182 <div>
183 <h3 class="title"><a id="idp50079688"></a>Class</h3>
184 </div>
185 </div>
186 </div>
187 <p>
188 <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
189 </p>
190 </div>
191 <div class="sect2" lang="en" xml:lang="en">
192 <div class="titlepage">
193 <div>
194 <div>
195 <h3 class="title"><a id="idp50074808"></a>See Also</h3>
196 </div>
197 </div>
198 </div>
199 <p>
200 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a>
201 </p>
202 </div>
203 </div>
204 <div class="navfooter">
205 <hr />
206 <table width="100%" summary="Navigation footer">
207 <tr>
208 <td width="40%" align="left"><a accesskey="p" href="dbset_alloc.html">Prev</a> </td>
209 <td width="20%" align="center">
210 <a accesskey="u" href="db.html">Up</a>
211 </td>
212 <td width="40%" align="right"> <a accesskey="n" href="dbset_bt_compare.html">Next</a></td>
213 </tr>
214 <tr>
215 <td width="40%" align="left" valign="top">DB-&gt;set_alloc() </td>
216 <td width="20%" align="center">
217 <a accesskey="h" href="index.html">Home</a>
218 </td>
219 <td width="40%" align="right" valign="top"> DB-&gt;set_bt_compare()</td>
220 </tr>
221 </table>
222 </div>
223 </body>
224 </html>