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::set_create_dir()</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="envset_data_dir.html" title="DbEnv::set_data_dir()" /> 12 <link rel="next" href="envset_encrypt.html" title="DbEnv::set_encrypt()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::set_create_dir()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envset_data_dir.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="envset_encrypt.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="envset_create_dir"></a>DbEnv::set_create_dir()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_create_dir(const char *dir); </pre> 42 <p> 43 Sets the path of a directory to be used as the location to create the access 44 method database files. When the 45 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> function is used to 46 create a file it will be created relative to this path. 47 </p> 48 <p> 49 If no database directories are specified, database files will be created 50 either by absolute paths or relative to the environment home 51 directory. See 52 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a> 53 for more information. 54 </p> 55 <p> 56 The database environment's create directory may also be configured 57 using the environment's 58 <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 59 syntax of the entry in that file is a single line with the string 60 "set_create_dir", one or more whitespace characters, and the directory 61 name. 62 </p> 63 <p> 64 The <code class="methodname">DbEnv::set_create_dir()</code> method configures operations performed 65 using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 66 handle, not all operations performed on the underlying database environment. 67 </p> 68 <p> 69 The <code class="methodname">DbEnv::set_create_dir()</code> method may be called at any time. 70 </p> 71 <p> 72 The <code class="methodname">DbEnv::set_create_dir()</code> <span> 73 74 <span> 75 method either returns a non-zero error value or throws an 76 exception that encapsulates a non-zero error value on 77 failure, and returns 0 on success. 78 </span> 79 </span> 80 </p> 81 <div class="sect2" lang="en" xml:lang="en"> 82 <div class="titlepage"> 83 <div> 84 <div> 85 <h3 class="title"><a id="id1669856"></a>Parameters</h3> 86 </div> 87 </div> 88 </div> 89 <div class="sect3" lang="en" xml:lang="en"> 90 <div class="titlepage"> 91 <div> 92 <div> 93 <h4 class="title"><a id="id1669874"></a>dir</h4> 94 </div> 95 </div> 96 </div> 97 <p> 98 The <span class="bold"><strong>dir</strong></span> parameter is a directory to 99 be used to create database files. 100 This directory must be one of the directories specified via a call to 101 <a class="xref" href="envadd_data_dir.html" title="DbEnv::add_data_dir()">DbEnv::add_data_dir()</a> 102 </p> 103 <p> 104 When using a Unicode build on Windows (the default), this argument will be interpreted 105 as a UTF-8 string, which is equivalent to ASCII for Latin characters. 106 </p> 107 </div> 108 </div> 109 <div class="sect2" lang="en" xml:lang="en"> 110 <div class="titlepage"> 111 <div> 112 <div> 113 <h3 class="title"><a id="id1669869"></a>Errors</h3> 114 </div> 115 </div> 116 </div> 117 <p> 118 The <code class="methodname">DbEnv::set_create_dir()</code> <span> 119 120 <span> 121 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 122 exception, encapsulating one of the following non-zero errors, or return one 123 of the following non-zero errors: 124 </span> 125 </span> 126 </p> 127 <div class="sect3" lang="en" xml:lang="en"> 128 <div class="titlepage"> 129 <div> 130 <div> 131 <h4 class="title"><a id="id1669941"></a>EINVAL</h4> 132 </div> 133 </div> 134 </div> 135 <p> 136 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 137 was called; or if an invalid flag value or parameter was specified. 138 </p> 139 </div> 140 </div> 141 <div class="sect2" lang="en" xml:lang="en"> 142 <div class="titlepage"> 143 <div> 144 <div> 145 <h3 class="title"><a id="id1669922"></a>Class</h3> 146 </div> 147 </div> 148 </div> 149 <p> 150 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 151 </p> 152 </div> 153 <div class="sect2" lang="en" xml:lang="en"> 154 <div class="titlepage"> 155 <div> 156 <div> 157 <h3 class="title"><a id="id1669885"></a>See Also</h3> 158 </div> 159 </div> 160 </div> 161 <p> 162 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 163 </p> 164 </div> 165 </div> 166 <div class="navfooter"> 167 <hr /> 168 <table width="100%" summary="Navigation footer"> 169 <tr> 170 <td width="40%" align="left"><a accesskey="p" href="envset_data_dir.html">Prev</a> </td> 171 <td width="20%" align="center"> 172 <a accesskey="u" href="env.html">Up</a> 173 </td> 174 <td width="40%" align="right"> <a accesskey="n" href="envset_encrypt.html">Next</a></td> 175 </tr> 176 <tr> 177 <td width="40%" align="left" valign="top">DbEnv::set_data_dir() </td> 178 <td width="20%" align="center"> 179 <a accesskey="h" href="index.html">Home</a> 180 </td> 181 <td width="40%" align="right" valign="top"> DbEnv::set_encrypt()</td> 182 </tr> 183 </table> 184 </div> 185 </body> 186</html> 187