Debian Codegraph @

docs/api_reference/CXX/dbupgrade.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::upgrade()</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="dbtruncate.html" title="Db::truncate()" />
12 <link rel="next" href="dbverify.html" title="Db::verify()" />
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::upgrade()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbtruncate.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="dbverify.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="dbupgrade"></a>Db::upgrade()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 Db::upgrade(const char *file, u_int32_t flags);</pre>
45 <p>
46 The <code class="methodname">Db::upgrade()</code> method upgrades all of the databases included in
47 the file <span class="bold"><strong>file</strong></span>, if necessary. If no
48 upgrade is necessary, <code class="methodname">Db::upgrade()</code> always returns success.
49 </p>
50 <p>
51 <span class="bold"><strong>Database upgrades are done in place and are
52 destructive. For example, if pages need to be allocated and no disk
53 space is available, the database may be left corrupted. Backups
54 should be made before databases are upgraded. See <a href="../../programmer_reference/am_upgrade.html" class="olink">Upgrading databases</a> for more
55 information.</strong></span>
56 </p>
57 <p>
58 Unlike all other database operations, <code class="methodname">Db::upgrade()</code> may only be done
59 on a system with the same byte-order as the database.
60 </p>
61 <p>
62 The <code class="methodname">Db::upgrade()</code> <span>
63
64 <span>
65 method either returns a non-zero error value or throws an
66 exception that encapsulates a non-zero error value on
67 failure, and returns 0 on success.
68 </span>
69 </span>
70 </p>
71 <div class="sect2" lang="en" xml:lang="en">
72 <div class="titlepage">
73 <div>
74 <div>
75 <h3 class="title"><a id="idp6000704"></a>Parameters</h3>
76 </div>
77 </div>
78 </div>
79 <div class="sect3" lang="en" xml:lang="en">
80 <div class="titlepage">
81 <div>
82 <div>
83 <h4 class="title"><a id="idp6001352"></a>file</h4>
84 </div>
85 </div>
86 </div>
87 <p>
88 The <span class="bold"><strong>file</strong></span> parameter is the physical
89 file containing the databases to be upgraded.
90 </p>
91 </div>
92 <div class="sect3" lang="en" xml:lang="en">
93 <div class="titlepage">
94 <div>
95 <div>
96 <h4 class="title"><a id="idp5978128"></a>flags</h4>
97 </div>
98 </div>
99 </div>
100 <p>
101 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
102 or the following value:
103 </p>
104 <div class="itemizedlist">
105 <ul type="disc">
106 <li>
107 <p><a id="upgrade_DB_DUPSORT"></a>
108 <code class="literal">DB_DUPSORT</code>
109 </p>
110 <p>
111 <span class="bold"><strong>This flag is only meaningful when upgrading
112 databases from releases before the Berkeley DB 3.1 release.</strong></span>
113 </p>
114 <p>
115 As part of the upgrade from the Berkeley DB 3.0 release to the 3.1
116 release, the on-disk format of duplicate data items changed. To
117 correctly upgrade the format requires applications to specify whether
118 duplicate data items in the database are sorted or not. Specifying
119 the DB_DUPSORT flag informs <code class="methodname">Db::upgrade()</code> that the duplicates are
120 sorted; otherwise they are assumed to be unsorted. Incorrectly
121 specifying the value of this flag may lead to database corruption.
122 </p>
123 <p>
124 Further, because the <code class="methodname">Db::upgrade()</code> method upgrades a physical file
125 (including all the databases it contains), it is not possible to use
126 <code class="methodname">Db::upgrade()</code> to upgrade files in which some of the databases it
127 includes have sorted duplicate data items, and some of the databases
128 it includes have unsorted duplicate data items. If the file does not
129 have more than a single database, if the databases do not support
130 duplicate data items, or if all of the databases that support
131 duplicate data items support the same style of duplicates (either
132 sorted or unsorted), <code class="methodname">Db::upgrade()</code> will work correctly as long as the
133 DB_DUPSORT flag is correctly specified. Otherwise, the file cannot be
134 upgraded using <code class="methodname">Db::upgrade;()</code> it must be upgraded manually by dumping
135 and reloading the databases.
136 </p>
137 </li>
138 </ul>
139 </div>
140 </div>
141 </div>
142 <div class="sect2" lang="en" xml:lang="en">
143 <div class="titlepage">
144 <div>
145 <div>
146 <h3 class="title"><a id="idp6019936"></a>Environment Variables</h3>
147 </div>
148 </div>
149 </div>
150 <p>
151 If the database was opened within a database environment, the
152 environment variable <code class="literal">DB_HOME</code> may be used as the path of the
153 database environment home.
154 </p>
155 <p>
156 <code class="methodname">Db::upgrade()</code> is affected by any database directory specified using the
157 <a class="xref" href="envset_data_dir.html" title="DbEnv::set_data_dir()">DbEnv::set_data_dir()</a>
158 method, or by setting the "set_data_dir" string
159 in the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.
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="idp6020792"></a>Errors</h3>
167 </div>
168 </div>
169 </div>
170 <p>
171 The <code class="methodname">Db::upgrade()</code> <span>
172
173 <span>
174 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
175 exception, encapsulating one of the following non-zero errors, or return one
176 of the following non-zero errors:
177 </span>
178 </span>
179 </p>
180 <div class="sect3" lang="en" xml:lang="en">
181 <div class="titlepage">
182 <div>
183 <div>
184 <h4 class="title"><a id="idp6028776"></a>DB_OLD_VERSION</h4>
185 </div>
186 </div>
187 </div>
188 <p>
189 The database cannot be upgraded by this version of the Berkeley DB
190 software.
191 </p>
192 </div>
193 </div>
194 <div class="sect2" lang="en" xml:lang="en">
195 <div class="titlepage">
196 <div>
197 <div>
198 <h3 class="title"><a id="idp6027696"></a>Class</h3>
199 </div>
200 </div>
201 </div>
202 <p>
203 <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>
204 </p>
205 </div>
206 <div class="sect2" lang="en" xml:lang="en">
207 <div class="titlepage">
208 <div>
209 <div>
210 <h3 class="title"><a id="idp6024424"></a>See Also</h3>
211 </div>
212 </div>
213 </div>
214 <p>
215 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a>
216 </p>
217 </div>
218 </div>
219 <div class="navfooter">
220 <hr />
221 <table width="100%" summary="Navigation footer">
222 <tr>
223 <td width="40%" align="left"><a accesskey="p" href="dbtruncate.html">Prev</a> </td>
224 <td width="20%" align="center">
225 <a accesskey="u" href="db.html">Up</a>
226 </td>
227 <td width="40%" align="right"> <a accesskey="n" href="dbverify.html">Next</a></td>
228 </tr>
229 <tr>
230 <td width="40%" align="left" valign="top">Db::truncate() </td>
231 <td width="20%" align="center">
232 <a accesskey="h" href="index.html">Home</a>
233 </td>
234 <td width="40%" align="right" valign="top"> Db::verify()</td>
235 </tr>
236 </table>
237 </div>
238 </body>
239 </html>