Debian Codegraph @

docs/api_reference/C/dbrename.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;rename()</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="dbremove.html" title="DB-&gt;remove()" />
12 <link rel="next" href="dbset_alloc.html" title="DB-&gt;set_alloc()" />
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;rename()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="dbremove.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_alloc.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="dbrename"></a>DB-&gt;rename()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB-&gt;rename(DB *db, const char *file,
45 const char *database, const char *newname, u_int32_t flags); </pre>
46 <p>
47 The <code class="methodname">DB-&gt;rename()</code> method renames the database specified by the
48 <span class="bold"><strong>file</strong></span> and <span class="bold"><strong>database</strong></span> parameters to <span class="bold"><strong>newname</strong></span>. If no <span class="bold"><strong>database</strong></span> is specified, the underlying file
49 represented by <span class="bold"><strong>file</strong></span> is renamed,
50 incidentally renaming all of the databases it contained.
51 </p>
52 <p>
53 Applications should not rename databases that are currently in use.
54 If an underlying file is being renamed and logging is currently
55 enabled in the database environment, no database in the file may be
56 open when the <code class="methodname">DB-&gt;rename()</code> method is called. In particular, some
57 architectures do not permit renaming files with open handles. On
58 these architectures, attempts to rename databases that are currently
59 in use by any thread of control in the system may fail.
60 </p>
61 <p>
62 The <code class="methodname">DB-&gt;rename()</code> method should not be called if the rename is
63 intended to be transactionally safe; the
64 <a class="xref" href="envdbrename.html" title="DB_ENV-&gt;dbrename()">DB_ENV-&gt;dbrename()</a> method
65 should be used instead.
66 </p>
67 <p>
68 The <code class="methodname">DB-&gt;rename()</code> method may not be called after calling the
69 <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method on any
70 <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a> handle. If the
71 <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a> method has already
72 been called on a <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
73 handle, close the existing handle and create a new one before calling
74 <code class="methodname">DB-&gt;rename()</code>.
75 </p>
76 <p>
77 The <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a> handle may not be
78 accessed again after <code class="methodname">DB-&gt;rename()</code> is called, regardless of its
79 return.
80 </p>
81 <p>
82 The <code class="methodname">DB-&gt;rename()</code> <span>
83 <span>
84 method returns a non-zero error value on failure and 0 on success.
85 </span>
86
87 </span>
88 </p>
89 <div class="sect2" lang="en" xml:lang="en">
90 <div class="titlepage">
91 <div>
92 <div>
93 <h3 class="title"><a id="idp50024464"></a>Parameters</h3>
94 </div>
95 </div>
96 </div>
97 <div class="sect3" lang="en" xml:lang="en">
98 <div class="titlepage">
99 <div>
100 <div>
101 <h4 class="title"><a id="idp50024656"></a>file</h4>
102 </div>
103 </div>
104 </div>
105 <p>
106 The <span class="bold"><strong>file</strong></span> parameter is the physical
107 file which contains the database(s) to be renamed.
108 </p>
109 <p>
110 When using a Unicode build on Windows (the default), the
111 <span class="bold"><strong>file</strong></span> argument will
112 be interpreted as a UTF-8 string, which is equivalent to ASCII for Latin
113 characters.
114 </p>
115 </div>
116 <div class="sect3" lang="en" xml:lang="en">
117 <div class="titlepage">
118 <div>
119 <div>
120 <h4 class="title"><a id="idp50016648"></a>database</h4>
121 </div>
122 </div>
123 </div>
124 <p>
125 The <span class="bold"><strong>database</strong></span> parameter is the
126 database to be renamed.
127 </p>
128 </div>
129 <div class="sect3" lang="en" xml:lang="en">
130 <div class="titlepage">
131 <div>
132 <div>
133 <h4 class="title"><a id="idp50005672"></a>newname</h4>
134 </div>
135 </div>
136 </div>
137 <p>
138 The <span class="bold"><strong>newname</strong></span> parameter is the new name
139 of the database or file.
140 </p>
141 </div>
142 <div class="sect3" lang="en" xml:lang="en">
143 <div class="titlepage">
144 <div>
145 <div>
146 <h4 class="title"><a id="idp50033336"></a>flags</h4>
147 </div>
148 </div>
149 </div>
150 <p>
151 The <span class="bold"><strong>flags</strong></span> parameter is currently unused, and must
152 be set to 0.
153 </p>
154 </div>
155 </div>
156 <div class="sect2" lang="en" xml:lang="en">
157 <div class="titlepage">
158 <div>
159 <div>
160 <h3 class="title"><a id="idp50034408"></a>Environment Variables</h3>
161 </div>
162 </div>
163 </div>
164 <p>
165 If the database was opened within a database environment, the
166 environment variable <code class="literal">DB_HOME</code> may be used as the path of the
167 database environment home.
168 </p>
169 <p>
170 <code class="methodname">DB-&gt;rename()</code> is affected by any database directory specified using the
171 <a class="xref" href="envset_data_dir.html" title="DB_ENV-&gt;set_data_dir()">DB_ENV-&gt;set_data_dir()</a>
172 method, or by setting the "set_data_dir" string
173 in the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.
174 </p>
175 </div>
176 <div class="sect2" lang="en" xml:lang="en">
177 <div class="titlepage">
178 <div>
179 <div>
180 <h3 class="title"><a id="idp50035488"></a>Errors</h3>
181 </div>
182 </div>
183 </div>
184 <p>
185 The <code class="methodname">DB-&gt;rename()</code> <span>
186 <span>
187 method may fail and return one of the following non-zero errors:
188 </span>
189
190 </span>
191 </p>
192 <div class="sect3" lang="en" xml:lang="en">
193 <div class="titlepage">
194 <div>
195 <div>
196 <h4 class="title"><a id="idp50039752"></a>EINVAL</h4>
197 </div>
198 </div>
199 </div>
200 <p>
201 If the method was called after <a class="xref" href="dbopen.html" title="DB-&gt;open()">DB-&gt;open()</a>
202 was called; or if an invalid flag value or parameter was specified.
203 </p>
204 </div>
205 <div class="sect3" lang="en" xml:lang="en">
206 <div class="titlepage">
207 <div>
208 <div>
209 <h4 class="title"><a id="idp50041424"></a>ENOENT</h4>
210 </div>
211 </div>
212 </div>
213 <p>
214 The file or directory does not exist.
215 </p>
216 </div>
217 </div>
218 <div class="sect2" lang="en" xml:lang="en">
219 <div class="titlepage">
220 <div>
221 <div>
222 <h3 class="title"><a id="idp50038896"></a>Class</h3>
223 </div>
224 </div>
225 </div>
226 <p>
227 <a class="link" href="db.html" title="Chapter 2.  The DB Handle">DB</a>
228 </p>
229 </div>
230 <div class="sect2" lang="en" xml:lang="en">
231 <div class="titlepage">
232 <div>
233 <div>
234 <h3 class="title"><a id="idp50042176"></a>See Also</h3>
235 </div>
236 </div>
237 </div>
238 <p>
239 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a>
240 </p>
241 </div>
242 </div>
243 <div class="navfooter">
244 <hr />
245 <table width="100%" summary="Navigation footer">
246 <tr>
247 <td width="40%" align="left"><a accesskey="p" href="dbremove.html">Prev</a> </td>
248 <td width="20%" align="center">
249 <a accesskey="u" href="db.html">Up</a>
250 </td>
251 <td width="40%" align="right"> <a accesskey="n" href="dbset_alloc.html">Next</a></td>
252 </tr>
253 <tr>
254 <td width="40%" align="left" valign="top">DB-&gt;remove() </td>
255 <td width="20%" align="center">
256 <a accesskey="h" href="index.html">Home</a>
257 </td>
258 <td width="40%" align="right" valign="top"> DB-&gt;set_alloc()</td>
259 </tr>
260 </table>
261 </div>
262 </body>
263 </html>