1<!--$Id: env_set_tmp_dir.so,v 10.27 2008/01/15 13:07:24 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;set_tmp_dir</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;set_tmp_dir</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;set_tmp_dir(DB_ENV *dbenv, const char *dir);
26<p>
27int
28DB_ENV-&gt;get_tmp_dir(DB_ENV *dbenv, const char **dirp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;set_tmp_dir</b>
32<a name="2"><!--meow--></a>
33<p>Specify the path of a directory to be used as the location of temporary
34files.  The files created to back in-memory access method databases will
35be created relative to this path.  These temporary files can be quite
36large, depending on the size of the database.</p>
37<p>If no directories are specified, the following alternatives are checked
38in the specified order.  The first existing directory path is used for
39all temporary files.</p>
40<ol>
41<p><li>The value of the environment variable <b>TMPDIR</b>.
42<li>The value of the environment variable <b>TEMP</b>.
43<li>The value of the environment variable <b>TMP</b>.
44<li>The value of the environment variable <b>TempFolder</b>.
45<li>The value returned by the GetTempPath interface.
46<li>The directory <b>/var/tmp</b>.
47<li>The directory <b>/usr/tmp</b>.
48<li>The directory <b>/temp</b>.
49<li>The directory <b>/tmp</b>.
50<li>The directory <b>C:/temp</b>.
51<li>The directory <b>C:/tmp</b>.
52</ol>
53<p>Note: environment variables are only checked if one of the
54<a href="../api_c/env_open.html#DB_USE_ENVIRON">DB_USE_ENVIRON</a> or <a href="../api_c/env_open.html#DB_USE_ENVIRON_ROOT">DB_USE_ENVIRON_ROOT</a> flags were
55specified.</p>
56<p>Note: the GetTempPath interface is only checked on Win/32 platforms.</p>
57<p>The database environment's temporary file directory may also be configured using the
58environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
59file is a single line with the string "set_tmp_dir", one or more whitespace
60characters, and the directory name.
61Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
62is opened, it will silently overrule configuration done before that
63time.</p>
64<p>The DB_ENV-&gt;set_tmp_dir method configures operations performed using the specified
65<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying
66database environment.</p>
67<p>The DB_ENV-&gt;set_tmp_dir method may be called at any time during the life of the
68application.</p>
69<p>The DB_ENV-&gt;set_tmp_dir method
70returns a non-zero error value on failure
71and 0 on success.
72</p>
73<b>Parameters</b> <br>
74 <b>dir</b><ul compact><li>The <b>dir</b> parameter is the directory to be used to store temporary
75files.</ul>
76<p>When using a Unicode build on Windows (the default), the <b>dir</b>
77argument will be interpreted as a UTF-8 string, which is equivalent to
78ASCII for Latin characters.</p>
79<br>
80<br><b>Errors</b>
81<p>The DB_ENV-&gt;set_tmp_dir method
82may fail and return one of the following non-zero errors:</p>
83<br>
84<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> was called; or if an
85invalid flag value or parameter was specified.</ul>
86<br>
87<hr size=1 noshade>
88<b>Description: DB_ENV-&gt;get_tmp_dir</b>
89<p>The DB_ENV-&gt;get_tmp_dir method returns the database environment temporary file directory.</p>
90<p>The DB_ENV-&gt;get_tmp_dir method may be called at any time during the life of the
91application.</p>
92<p>The DB_ENV-&gt;get_tmp_dir method
93returns a non-zero error value on failure
94and 0 on success.
95</p>
96<b>Parameters</b> <br>
97 <b>dirp</b><ul compact><li>The DB_ENV-&gt;get_tmp_dir method returns a reference to the
98database environment temporary file directory in <b>dirp</b>.</ul>
99<br>
100<hr size=1 noshade>
101<br><b>Class</b>
102<a href="../api_c/env_class.html">DB_ENV</a>
103<br><b>See Also</b>
104<a href="../api_c/env_list.html">Database Environments and Related Methods</a>
105</tt>
106<table width="100%"><tr><td><br></td><td align=right>
107<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
108</td></tr></table>
109<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
110</body>
111</html>
112