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: DbEnv::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>DbEnv::set_tmp_dir</b>
14</td>
15<td align=right>
16<a href="../api_cxx/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_cxx.h&gt;
23<p>
24int
25DbEnv::set_tmp_dir(const char *dir);
26<p>
27int
28DbEnv::get_tmp_dir(const char **dirp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::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_cxx/env_open.html#DB_USE_ENVIRON">DB_USE_ENVIRON</a> or <a href="../api_cxx/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 DbEnv::set_tmp_dir method configures operations performed using the specified
65<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
66database environment.</p>
67<p>The DbEnv::set_tmp_dir method may be called at any time during the life of the
68application.</p>
69<p>The DbEnv::set_tmp_dir method
70either returns a non-zero error value
71or throws an exception that encapsulates a non-zero error value on
72failure, and returns 0 on success.
73</p>
74<b>Parameters</b> <br>
75 <b>dir</b><ul compact><li>The <b>dir</b> parameter is the directory to be used to store temporary
76files.</ul>
77<p>When using a Unicode build on Windows (the default), the <b>dir</b>
78argument will be interpreted as a UTF-8 string, which is equivalent to
79ASCII for Latin characters.</p>
80<br>
81<br><b>Errors</b>
82<p>The DbEnv::set_tmp_dir method
83may fail and throw
84<a href="../api_cxx/except_class.html">DbException</a>,
85encapsulating one of the following non-zero errors, or return one of
86the following non-zero errors:</p>
87<br>
88<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; or if an
89invalid flag value or parameter was specified.</ul>
90<br>
91<hr size=1 noshade>
92<b>Description: DbEnv::get_tmp_dir</b>
93<p>The DbEnv::get_tmp_dir method returns the database environment temporary file directory.</p>
94<p>The DbEnv::get_tmp_dir method may be called at any time during the life of the
95application.</p>
96<p>The DbEnv::get_tmp_dir method
97either returns a non-zero error value
98or throws an exception that encapsulates a non-zero error value on
99failure, and returns 0 on success.
100</p>
101<b>Parameters</b> <br>
102 <b>dirp</b><ul compact><li>The DbEnv::get_tmp_dir method returns a reference to the
103database environment temporary file directory in <b>dirp</b>.</ul>
104<br>
105<hr size=1 noshade>
106<br><b>Class</b>
107<a href="../api_cxx/env_class.html">DbEnv</a>
108<br><b>See Also</b>
109<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
110</tt>
111<table width="100%"><tr><td><br></td><td align=right>
112<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
113</td></tr></table>
114<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
115</body>
116</html>
117