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_ENV->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 DB_ENV Handle" /> 11 <link rel="prev" href="envset_timeout.html" title="DB_ENV->set_timeout()" /> 12 <link rel="next" href="envset_verbose.html" title="DB_ENV->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">DB_ENV->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 DB_ENV 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>DB_ENV->set_tmp_dir()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_tmp_dir(DB_ENV *dbenv, 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">DB_ENV->set_tmp_dir()</code> method configures operations performed 138 using the specified <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle, not all 139 operations performed on the underlying database environment. 140 </p> 141 <p> 142 The <code class="methodname">DB_ENV->set_tmp_dir()</code> <span> 143 <span> 144 method returns a non-zero error value on failure and 0 on success. 145 </span> 146 147 </span> 148 </p> 149 <div class="sect2" lang="en" xml:lang="en"> 150 <div class="titlepage"> 151 <div> 152 <div> 153 <h3 class="title"><a id="id1672698"></a>Parameters</h3> 154 </div> 155 </div> 156 </div> 157 <div class="sect3" lang="en" xml:lang="en"> 158 <div class="titlepage"> 159 <div> 160 <div> 161 <h4 class="title"><a id="id1673300"></a>dir</h4> 162 </div> 163 </div> 164 </div> 165 <p> 166 The <span class="bold"><strong>dir</strong></span> parameter is the directory to 167 be used to store temporary files. 168 </p> 169 <p> 170 When using a Unicode build on Windows (the default), the this argument will be interpreted 171 as a UTF-8 string, which is equivalent to ASCII for Latin characters. 172 </p> 173 </div> 174 </div> 175 <div class="sect2" lang="en" xml:lang="en"> 176 <div class="titlepage"> 177 <div> 178 <div> 179 <h3 class="title"><a id="id1673396"></a>Errors</h3> 180 </div> 181 </div> 182 </div> 183 <p> 184 The <code class="methodname">DB_ENV->set_tmp_dir()</code> <span> 185 <span> 186 method may fail and return one of the following non-zero errors: 187 </span> 188 189 </span> 190 </p> 191 <div class="sect3" lang="en" xml:lang="en"> 192 <div class="titlepage"> 193 <div> 194 <div> 195 <h4 class="title"><a id="id1673416"></a>EINVAL</h4> 196 </div> 197 </div> 198 </div> 199 <p> 200 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> 201 was called; or if an invalid flag value or parameter was specified. 202 </p> 203 </div> 204 </div> 205 <div class="sect2" lang="en" xml:lang="en"> 206 <div class="titlepage"> 207 <div> 208 <div> 209 <h3 class="title"><a id="id1673417"></a>Class</h3> 210 </div> 211 </div> 212 </div> 213 <p> 214 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 215 </p> 216 </div> 217 <div class="sect2" lang="en" xml:lang="en"> 218 <div class="titlepage"> 219 <div> 220 <div> 221 <h3 class="title"><a id="id1672691"></a>See Also</h3> 222 </div> 223 </div> 224 </div> 225 <p> 226 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 227 </p> 228 </div> 229 </div> 230 <div class="navfooter"> 231 <hr /> 232 <table width="100%" summary="Navigation footer"> 233 <tr> 234 <td width="40%" align="left"><a accesskey="p" href="envset_timeout.html">Prev</a>��</td> 235 <td width="20%" align="center"> 236 <a accesskey="u" href="env.html">Up</a> 237 </td> 238 <td width="40%" align="right">��<a accesskey="n" href="envset_verbose.html">Next</a></td> 239 </tr> 240 <tr> 241 <td width="40%" align="left" valign="top">DB_ENV->set_timeout()��</td> 242 <td width="20%" align="center"> 243 <a accesskey="h" href="index.html">Home</a> 244 </td> 245 <td width="40%" align="right" valign="top">��DB_ENV->set_verbose()</td> 246 </tr> 247 </table> 248 </div> 249 </body> 250</html> 251