Debian Codegraph @

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