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_tmp_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_timeout.html" title="DbEnv::set_timeout()" /> 12 <link rel="next" href="envset_verbose.html" title="DbEnv::set_verbose()" /> 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_tmp_dir()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envset_timeout.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_verbose.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_tmp_dir"></a>DbEnv::set_tmp_dir()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_tmp_dir(const char *dir); </pre> 42 <p> 43 Specify the path of a directory to be used as the location of 44 temporary files. The files created to back in-memory access method 45 databases will be created relative to this path. These temporary 46 files can be quite large, depending on the size of the database. 47 </p> 48 <p> 49 If no directories are specified, the following alternatives are 50 checked in the specified order. The first existing directory path is 51 used for all temporary files. 52 </p> 53 <div class="orderedlist"> 54 <ol type="1"> 55 <li> 56 <p> 57 The value of the environment variable <span class="bold"><strong>TMPDIR</strong></span>. 58 </p> 59 </li> 60 <li> 61 <p> 62 The value of the environment variable <span class="bold"><strong>TEMP</strong></span>. 63 </p> 64 </li> 65 <li> 66 <p> 67 The value of the environment variable <span class="bold"><strong>TMP</strong></span>. 68 </p> 69 </li> 70 <li> 71 <p> 72 The value of the environment variable <span class="bold"><strong>TempFolder</strong></span>. 73 </p> 74 </li> 75 <li> 76 <p> 77 The value returned by the <span class="bold"><strong>GetTempPath</strong></span> interface. 78 </p> 79 </li> 80 <li> 81 <p> 82 The directory <span class="bold"><strong>/var/tmp</strong></span>. 83 </p> 84 </li> 85 <li> 86 <p> 87 The directory <span class="bold"><strong>/usr/tmp</strong></span>. 88 </p> 89 </li> 90 <li> 91 <p> 92 The directory <span class="bold"><strong>/temp</strong></span>. 93 </p> 94 </li> 95 <li> 96 <p> 97 The directory <span class="bold"><strong>/tmp</strong></span>. 98 </p> 99 </li> 100 <li> 101 <p> 102 The directory <span class="bold"><strong>C:/temp</strong></span>. 103 </p> 104 </li> 105 <li> 106 <p> 107 The directory <span class="bold"><strong>C:/tmp</strong></span>. 108 </p> 109 </li> 110 </ol> 111 </div> 112 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 113 <h3 class="title">Note</h3> 114 <p> 115 Environment variables are only checked if one of the 116 <a class="link" href="envopen.html#envopen_DB_USE_ENVIRON">DB_USE_ENVIRON</a> or 117 <a class="link" href="envopen.html#envopen_DB_USE_ENVIRON_ROOT">DB_USE_ENVIRON_ROOT</a> 118 flags were specified. 119 </p> 120 </div> 121 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 122 <h3 class="title">Note</h3> 123 <p> 124 The GetTempPath interface is only checked on Win/32 platforms. 125 </p> 126 </div> 127 <p> 128 The database environment's temporary file directory may also be 129 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 130 syntax of the entry in that file is a single line with the string 131 "set_tmp_dir", one or more whitespace characters, and the directory 132 name. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 133 read when the database environment is opened, it will silently 134 overrule configuration done before that time. 135 </p> 136 <p> 137 The <code class="methodname">DbEnv::set_tmp_dir()</code> method configures operations performed 138 using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle, not all 139 operations performed on the underlying database environment. 140 </p> 141 <p> 142 The <code class="methodname">DbEnv::set_tmp_dir()</code> <span> 143 144 <span> 145 method either returns a non-zero error value or throws an 146 exception that encapsulates a non-zero error value on 147 failure, and returns 0 on success. 148 </span> 149 </span> 150 </p> 151 <div class="sect2" lang="en" xml:lang="en"> 152 <div class="titlepage"> 153 <div> 154 <div> 155 <h3 class="title"><a id="id1676086"></a>Parameters</h3> 156 </div> 157 </div> 158 </div> 159 <div class="sect3" lang="en" xml:lang="en"> 160 <div class="titlepage"> 161 <div> 162 <div> 163 <h4 class="title"><a id="id1675647"></a>dir</h4> 164 </div> 165 </div> 166 </div> 167 <p> 168 The <span class="bold"><strong>dir</strong></span> parameter is the directory to 169 be used to store temporary files. 170 </p> 171 <p> 172 When using a Unicode build on Windows (the default), the this argument will be interpreted 173 as a UTF-8 string, which is equivalent to ASCII for Latin characters. 174 </p> 175 </div> 176 </div> 177 <div class="sect2" lang="en" xml:lang="en"> 178 <div class="titlepage"> 179 <div> 180 <div> 181 <h3 class="title"><a id="id1676358"></a>Errors</h3> 182 </div> 183 </div> 184 </div> 185 <p> 186 The <code class="methodname">DbEnv::set_tmp_dir()</code> <span> 187 188 <span> 189 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 190 exception, encapsulating one of the following non-zero errors, or return one 191 of the following non-zero errors: 192 </span> 193 </span> 194 </p> 195 <div class="sect3" lang="en" xml:lang="en"> 196 <div class="titlepage"> 197 <div> 198 <div> 199 <h4 class="title"><a id="id1676154"></a>EINVAL</h4> 200 </div> 201 </div> 202 </div> 203 <p> 204 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 205 was called; or if an invalid flag value or parameter was specified. 206 </p> 207 </div> 208 </div> 209 <div class="sect2" lang="en" xml:lang="en"> 210 <div class="titlepage"> 211 <div> 212 <div> 213 <h3 class="title"><a id="id1676156"></a>Class</h3> 214 </div> 215 </div> 216 </div> 217 <p> 218 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 219 </p> 220 </div> 221 <div class="sect2" lang="en" xml:lang="en"> 222 <div class="titlepage"> 223 <div> 224 <div> 225 <h3 class="title"><a id="id1676189"></a>See Also</h3> 226 </div> 227 </div> 228 </div> 229 <p> 230 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 231 </p> 232 </div> 233 </div> 234 <div class="navfooter"> 235 <hr /> 236 <table width="100%" summary="Navigation footer"> 237 <tr> 238 <td width="40%" align="left"><a accesskey="p" href="envset_timeout.html">Prev</a> </td> 239 <td width="20%" align="center"> 240 <a accesskey="u" href="env.html">Up</a> 241 </td> 242 <td width="40%" align="right"> <a accesskey="n" href="envset_verbose.html">Next</a></td> 243 </tr> 244 <tr> 245 <td width="40%" align="left" valign="top">DbEnv::set_timeout() </td> 246 <td width="20%" align="center"> 247 <a accesskey="h" href="index.html">Home</a> 248 </td> 249 <td width="40%" align="right" valign="top"> DbEnv::set_verbose()</td> 250 </tr> 251 </table> 252 </div> 253 </body> 254</html> 255