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>DbEnv::fileid_reset()</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="env.html" title="Chapter 5. The DbEnv Handle" /> 11 <link rel="prev" href="envfailchk.html" title="DbEnv::failchk()" /> 12 <link rel="next" href="envget_create_dir.html" title="DbEnv::get_create_dir()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::fileid_reset()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envfailchk.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 5. 23 The DbEnv Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="envget_create_dir.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="envfileid_reset"></a>DbEnv::fileid_reset()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::fileid_reset(const char *file, u_int32_t flags);</pre> 42 <p> 43 The <code class="methodname">DbEnv::fileid_reset()</code> method allows database files to be copied, 44 and then the copy used in the same database environment as the 45 original. 46 </p> 47 <p> 48 All databases contain an ID string used to identify the database in 49 the database environment cache. If a physical database file is 50 copied, and used in the same environment as another file with the same 51 ID strings, corruption can occur. The <code class="methodname">DbEnv::fileid_reset()</code> method 52 creates new ID strings for all of the databases in the physical file. 53 </p> 54 <p> 55 The <code class="methodname">DbEnv::fileid_reset()</code> method modifies the physical file, 56 in-place. Applications should not reset IDs in files that are 57 currently in use. 58 </p> 59 <p> 60 The <code class="methodname">DbEnv::fileid_reset()</code> method may be called at any time during 61 the life of the application. 62 </p> 63 <p> 64 The <code class="methodname">DbEnv::fileid_reset()</code> <span> 65 66 <span> 67 method either returns a non-zero error value or throws an 68 exception that encapsulates a non-zero error value on 69 failure, and returns 0 on success. 70 </span> 71 </span> 72 </p> 73 <div class="sect2" lang="en" xml:lang="en"> 74 <div class="titlepage"> 75 <div> 76 <div> 77 <h3 class="title"><a id="id1664846"></a>Parameters</h3> 78 </div> 79 </div> 80 </div> 81 <div class="sect3" lang="en" xml:lang="en"> 82 <div class="titlepage"> 83 <div> 84 <div> 85 <h4 class="title"><a id="id1664732"></a>file</h4> 86 </div> 87 </div> 88 </div> 89 <p> 90 The name of the physical file in which new file IDs are to be created. 91 </p> 92 </div> 93 <div class="sect3" lang="en" xml:lang="en"> 94 <div class="titlepage"> 95 <div> 96 <div> 97 <h4 class="title"><a id="id1664755"></a>flags</h4> 98 </div> 99 </div> 100 </div> 101 <p> 102 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 103 or the following value: 104 </p> 105 <div class="itemizedlist"> 106 <ul type="disc"> 107 <li> 108 <p> 109 <code class="literal">DB_ENCRYPT</code> 110 </p> 111 <p> 112 The file contains encrypted databases. 113 </p> 114 </li> 115 </ul> 116 </div> 117 </div> 118 </div> 119 <div class="sect2" lang="en" xml:lang="en"> 120 <div class="titlepage"> 121 <div> 122 <div> 123 <h3 class="title"><a id="id1665043"></a>Errors</h3> 124 </div> 125 </div> 126 </div> 127 <p> 128 The <code class="methodname">DbEnv::fileid_reset()</code> <span> 129 130 <span> 131 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 132 exception, encapsulating one of the following non-zero errors, or return one 133 of the following non-zero errors: 134 </span> 135 </span> 136 </p> 137 <div class="sect3" lang="en" xml:lang="en"> 138 <div class="titlepage"> 139 <div> 140 <div> 141 <h4 class="title"><a id="id1664838"></a>EINVAL</h4> 142 </div> 143 </div> 144 </div> 145 <p> 146 An invalid flag value or parameter was specified. 147 </p> 148 </div> 149 </div> 150 <div class="sect2" lang="en" xml:lang="en"> 151 <div class="titlepage"> 152 <div> 153 <div> 154 <h3 class="title"><a id="id1665181"></a>Class</h3> 155 </div> 156 </div> 157 </div> 158 <p> 159 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 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="id1664939"></a>See Also</h3> 167 </div> 168 </div> 169 </div> 170 <p> 171 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 172 </p> 173 </div> 174 </div> 175 <div class="navfooter"> 176 <hr /> 177 <table width="100%" summary="Navigation footer"> 178 <tr> 179 <td width="40%" align="left"><a accesskey="p" href="envfailchk.html">Prev</a> </td> 180 <td width="20%" align="center"> 181 <a accesskey="u" href="env.html">Up</a> 182 </td> 183 <td width="40%" align="right"> <a accesskey="n" href="envget_create_dir.html">Next</a></td> 184 </tr> 185 <tr> 186 <td width="40%" align="left" valign="top">DbEnv::failchk() </td> 187 <td width="20%" align="center"> 188 <a accesskey="h" href="index.html">Home</a> 189 </td> 190 <td width="40%" align="right" valign="top"> DbEnv::get_create_dir()</td> 191 </tr> 192 </table> 193 </div> 194 </body> 195</html> 196