Debian Codegraph @

docs/api_reference/C/dbverify.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;verify()</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="dbupgrade.html" title="DB-&gt;upgrade()" />
12 <link rel="next" href="db_heap_rid.html" title="DB_HEAP_RID" />
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;verify()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbupgrade.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="db_heap_rid.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="dbverify"></a>DB-&gt;verify()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB-&gt;verify(DB *db, const char *file,
45 const char *database, FILE *outfile, u_int32_t flags); </pre>
46 <p>
47 The <code class="methodname">DB-&gt;verify()</code> method verifies the integrity of all databases in
48 the file specified by the <span class="bold"><strong>file</strong></span>
49 parameter, and optionally outputs the databases' key/data pairs to the
50 file stream specified by the <span class="bold"><strong>outfile</strong></span>
51 parameter.
52 </p>
53 <p>
54 <span class="bold"><strong>The <code class="methodname">DB-&gt;verify()</code> method does not perform any
55 locking, even in Berkeley DB environments that are configured with a
56 locking subsystem. As such, it should only be used on files that are
57 not being modified by another thread of control.</strong></span>
58 </p>
59 <p>
60 The <code class="methodname">DB-&gt;verify()</code> method may not be called after the
61 <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method is called.
62 </p>
63 <p>
64 The <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a> handle may not be
65 accessed again after <code class="methodname">DB-&gt;verify()</code> is called, regardless of its
66 return.
67 </p>
68 <p>
69 The <code class="methodname">DB-&gt;verify()</code> method is the
70 underlying method used by the
71 <a class="link" href="db_verify.html" title="db_verify">db_verify</a> utility. See the
72 <a class="link" href="db_verify.html" title="db_verify">db_verify</a> utility source code for
73 an example of using <code class="methodname">DB-&gt;verify()</code> in a
74 IEEE/ANSI Std 1003.1 (POSIX) environment.
75 </p>
76 <p>
77 The <code class="methodname">DB-&gt;verify()</code> method will return DB_VERIFY_BAD if a database is
78 corrupted. When the DB_SALVAGE flag is specified, the DB_VERIFY_BAD
79 return means that all key/data pairs in the file may not have been
80 successfully output. Unless otherwise specified, the <code class="methodname">DB-&gt;verify()</code>
81 <span>
82 <span>
83 method returns a non-zero error value on failure and 0 on success.
84 </span>
85
86 </span>
87 </p>
88 <div class="sect2" lang="en" xml:lang="en">
89 <div class="titlepage">
90 <div>
91 <div>
92 <h3 class="title"><a id="idp50744672"></a>Parameters</h3>
93 </div>
94 </div>
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="idp50752312"></a>file</h4>
101 </div>
102 </div>
103 </div>
104 <p>
105 The <span class="bold"><strong>file</strong></span> parameter is the physical
106 file in which the databases to be verified are found.
107 </p>
108 </div>
109 <div class="sect3" lang="en" xml:lang="en">
110 <div class="titlepage">
111 <div>
112 <div>
113 <h4 class="title"><a id="idp50706024"></a>database</h4>
114 </div>
115 </div>
116 </div>
117 <p>
118 The <span class="bold"><strong>database</strong></span> parameter is the
119 database in <span class="bold"><strong>file</strong></span> on which the
120 database checks for btree and duplicate sort order and for hashing are
121 to be performed. See the DB_ORDERCHKONLY flag for more information.
122 </p>
123 <p>
124 The database parameter must be set to NULL except when the
125 DB_ORDERCHKONLY flag is set.
126 </p>
127 </div>
128 <div class="sect3" lang="en" xml:lang="en">
129 <div class="titlepage">
130 <div>
131 <div>
132 <h4 class="title"><a id="idp50753976"></a>outfile</h4>
133 </div>
134 </div>
135 </div>
136 <p>
137 The <span class="bold"><strong>outfile</strong></span> parameter is an optional
138 file stream to which the databases' key/data pairs are written.
139 </p>
140 </div>
141 <div class="sect3" lang="en" xml:lang="en">
142 <div class="titlepage">
143 <div>
144 <div>
145 <h4 class="title"><a id="idp50741816"></a>flags</h4>
146 </div>
147 </div>
148 </div>
149 <p>
150 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
151 or the following value:
152 </p>
153 <div class="itemizedlist">
154 <ul type="disc">
155 <li>
156 <p><a id="verify_DB_SALVAGE"></a>
157 <code class="literal">DB_SALVAGE</code>
158 </p>
159 <p>
160 Write the key/data pairs from all databases in the file to the file
161 stream named in the <span class="bold"><strong>outfile</strong></span>
162 parameter. Key values are written for Btree, Hash and Queue
163 databases, but not for Recno databases.
164 </p>
165 <p>
166 The output format is the same as that specified for the <a class="link" href="db_dump.html" title="db_dump">db_dump</a> utility, and can be used
167 as input for the <a class="link" href="db_load.html" title="db_load">db_load</a>
168 utility.
169 </p>
170 <p>
171 Because the key/data pairs are output in page order as opposed to the
172 sort order used by <a class="link" href="db_dump.html" title="db_dump">db_dump</a>, using <code class="methodname">DB-&gt;verify()</code> to
173 dump key/data pairs normally produces less than optimal loads for
174 Btree databases.
175 </p>
176 </li>
177 </ul>
178 </div>
179 <p>
180 In addition, the following flags may be set by bitwise inclusively
181 <span class="bold"><strong>OR</strong></span>'ing them into the <span class="bold"><strong>flags</strong></span> parameter:
182 </p>
183 <div class="itemizedlist">
184 <ul type="disc">
185 <li>
186 <p><a id="verify_DB_AGGRESSIVE"></a>
187 <code class="literal">DB_AGGRESSIVE</code>
188 </p>
189 <p>
190 Output <span class="bold"><strong>all</strong></span> the key/data pairs in the
191 file that can be found. By default, <code class="methodname">DB-&gt;verify()</code> does not assume
192 corruption. For example, if a key/data pair on a page is marked as
193 deleted, it is not then written to the output file. When
194 DB_AGGRESSIVE is specified, corruption is assumed, and any key/data
195 pair that can be found is written. In this case, key/data pairs that
196 are corrupted or have been deleted may appear in the output (even if
197 the file being salvaged is in no way corrupt), and the output will
198 almost certainly require editing before being loaded into a database.
199 </p>
200 </li>
201 <li>
202 <p><a id="verify_DB_PRINTABLE"></a>
203 <code class="literal">DB_PRINTABLE</code>
204 </p>
205 <p>
206 When using the DB_SALVAGE flag, if characters in either the key or
207 data items are printing characters (as defined by <span class="bold"><strong>isprint</strong></span>(3)), use printing characters to
208 represent them. This flag permits users to use standard text editors
209 and tools to modify the contents of databases or selectively remove
210 data from salvager output.
211 </p>
212 <p>
213 Note: different systems may have different notions about what
214 characters are considered <span class="emphasis"><em>printing characters</em></span>,
215 and databases dumped in this manner may be less portable to external
216 systems.
217 </p>
218 </li>
219 <li>
220 <p><a id="verify_DB_NOORDERCHK"></a>
221 <code class="literal">DB_NOORDERCHK</code>
222 </p>
223 <p>
224 Skip the database checks for btree and duplicate sort order and for
225 hashing.
226 </p>
227 <p>
228 The <code class="methodname">DB-&gt;verify()</code> method normally verifies that btree keys and
229 duplicate items are correctly sorted, and hash keys are correctly
230 hashed. If the file being verified contains multiple databases using
231 differing sorting or hashing algorithms, some of them must necessarily
232 fail database verification because only one sort order or hash
233 function can be specified before <code class="methodname">DB-&gt;verify()</code> is called. To verify
234 files with multiple databases having differing sorting orders or
235 hashing functions, first perform verification of the file as a whole
236 by using the DB_NOORDERCHK flag, and then individually verify the sort
237 order and hashing function for each database in the file using the
238 DB_ORDERCHKONLY flag.
239 </p>
240 </li>
241 <li>
242 <p><a id="verify_DB_ORDERCHKONLY"></a>
243 <code class="literal">DB_ORDERCHKONLY</code>
244 </p>
245 <p>
246 Perform the database checks for btree and duplicate sort order and for
247 hashing, skipped by DB_NOORDERCHK.
248 </p>
249 <p>
250 When this flag is specified, a <span class="bold"><strong>database</strong></span> parameter should also be specified,
251 indicating the database in the physical file which is to be checked.
252 This flag is only safe to use on databases that have already
253 successfully been verified using <code class="methodname">DB-&gt;verify()</code> with the DB_NOORDERCHK
254 flag set.
255 </p>
256 </li>
257 </ul>
258 </div>
259 </div>
260 </div>
261 <div class="sect2" lang="en" xml:lang="en">
262 <div class="titlepage">
263 <div>
264 <div>
265 <h3 class="title"><a id="idp50778072"></a>Environment Variables</h3>
266 </div>
267 </div>
268 </div>
269 <p>
270 If the database was opened within a database environment, the
271 environment variable <code class="literal">DB_HOME</code> may be used as the path of the
272 database environment home.
273 </p>
274 <p>
275 <code class="methodname">DB-&gt;verify()</code> is affected by any database directory specified using the
276 <a class="xref" href="envset_data_dir.html" title="DB_ENV-&gt;set_data_dir()">DB_ENV-&gt;set_data_dir()</a>
277 method, or by setting the "set_data_dir" string
278 in the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.
279 </p>
280 </div>
281 <div class="sect2" lang="en" xml:lang="en">
282 <div class="titlepage">
283 <div>
284 <div>
285 <h3 class="title"><a id="idp50747720"></a>Errors</h3>
286 </div>
287 </div>
288 </div>
289 <p>
290 The <code class="methodname">DB-&gt;verify()</code> <span>
291 <span>
292 method may fail and return one of the following non-zero errors:
293 </span>
294
295 </span>
296 </p>
297 <div class="sect3" lang="en" xml:lang="en">
298 <div class="titlepage">
299 <div>
300 <div>
301 <h4 class="title"><a id="idp50783800"></a>EINVAL</h4>
302 </div>
303 </div>
304 </div>
305 <p>
306 If the method was called after <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a>
307 was called; or if an invalid flag value or parameter was specified.
308 </p>
309 </div>
310 <div class="sect3" lang="en" xml:lang="en">
311 <div class="titlepage">
312 <div>
313 <div>
314 <h4 class="title"><a id="idp50773720"></a>ENOENT</h4>
315 </div>
316 </div>
317 </div>
318 <p>
319 The file or directory does not exist.
320 </p>
321 </div>
322 </div>
323 <div class="sect2" lang="en" xml:lang="en">
324 <div class="titlepage">
325 <div>
326 <div>
327 <h3 class="title"><a id="idp50786032"></a>Class</h3>
328 </div>
329 </div>
330 </div>
331 <p>
332 <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
333 </p>
334 </div>
335 <div class="sect2" lang="en" xml:lang="en">
336 <div class="titlepage">
337 <div>
338 <div>
339 <h3 class="title"><a id="idp50765792"></a>See Also</h3>
340 </div>
341 </div>
342 </div>
343 <p>
344 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a>
345 </p>
346 </div>
347 </div>
348 <div class="navfooter">
349 <hr />
350 <table width="100%" summary="Navigation footer">
351 <tr>
352 <td width="40%" align="left"><a accesskey="p" href="dbupgrade.html">Prev</a> </td>
353 <td width="20%" align="center">
354 <a accesskey="u" href="db.html">Up</a>
355 </td>
356 <td width="40%" align="right"> <a accesskey="n" href="db_heap_rid.html">Next</a></td>
357 </tr>
358 <tr>
359 <td width="40%" align="left" valign="top">DB-&gt;upgrade() </td>
360 <td width="20%" align="center">
361 <a accesskey="h" href="index.html">Home</a>
362 </td>
363 <td width="40%" align="right" valign="top"> DB_HEAP_RID</td>
364 </tr>
365 </table>
366 </div>
367 </body>
368 </html>