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::log_file()</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="lsn.html" title="Chapter��8.�� The DbLsn Handle" /> 11 <link rel="prev" href="logcursor.html" title="DbEnv::log_cursor()" /> 12 <link rel="next" href="logflush.html" title="DbEnv::log_flush()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::log_file()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="logcursor.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��8.�� 23 The DbLsn Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="logflush.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="logfile"></a>DbEnv::log_file()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::log_file(const DbLsn *lsn, char *namep, size_t len);</pre> 42 <p> 43 The <code class="methodname">DbEnv::log_file()</code> method maps 44 <code class="classname">DbLsn</code> structures to filenames, 45 returning the name of the file containing the record named by 46 <span class="bold"><strong>lsn</strong></span>. 47 </p> 48 <p> 49 This mapping of <code class="classname">DbLsn</code> structures to files is needed for database 50 administration. For example, a transaction manager typically records 51 the earliest <a class="link" href="lsn.html" title="Chapter��8.�� The DbLsn Handle">DbLsn</a> 52 needed for restart, and the database administrator may want to archive 53 log files to tape when they contain only 54 <a class="link" href="lsn.html" title="Chapter��8.�� The DbLsn Handle">DbLsn</a> entries before the 55 earliest one needed for restart. 56 </p> 57 <p> 58 The <code class="methodname">DbEnv::log_file()</code> <span> 59 60 <span> 61 method either returns a non-zero error value or throws an 62 exception that encapsulates a non-zero error value on 63 failure, and returns 0 on success. 64 </span> 65 </span> 66 </p> 67 <div class="sect2" lang="en" xml:lang="en"> 68 <div class="titlepage"> 69 <div> 70 <div> 71 <h3 class="title"><a id="id1684905"></a>Parameters</h3> 72 </div> 73 </div> 74 </div> 75 <div class="sect3" lang="en" xml:lang="en"> 76 <div class="titlepage"> 77 <div> 78 <div> 79 <h4 class="title"><a id="id1685353"></a>lsn</h4> 80 </div> 81 </div> 82 </div> 83 <p> 84 The <span class="bold"><strong>lsn</strong></span> parameter is the 85 <code class="classname">DbLsn</code> structure for which a 86 filename is wanted. 87 </p> 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="id1685422"></a>namep</h4> 94 </div> 95 </div> 96 </div> 97 <p> 98 The <span class="bold"><strong>namep</strong></span> parameter references memory 99 into which the name of the file containing the record named by 100 <span class="bold"><strong>lsn</strong></span> is copied. 101 </p> 102 </div> 103 <div class="sect3" lang="en" xml:lang="en"> 104 <div class="titlepage"> 105 <div> 106 <div> 107 <h4 class="title"><a id="id1685533"></a>len</h4> 108 </div> 109 </div> 110 </div> 111 <p> 112 The <span class="bold"><strong>len</strong></span> parameter is the length of 113 the <span class="bold"><strong>namep</strong></span> buffer in bytes. If 114 <span class="bold"><strong>namep</strong></span> is too short to hold the 115 filename, <code class="methodname">DbEnv::log_file()</code> will fail. (Log filenames 116 are always 14 characters long.) 117 </p> 118 </div> 119 </div> 120 <div class="sect2" lang="en" xml:lang="en"> 121 <div class="titlepage"> 122 <div> 123 <div> 124 <h3 class="title"><a id="id1685514"></a>Errors</h3> 125 </div> 126 </div> 127 </div> 128 <p> 129 The <code class="methodname">DbEnv::log_file()</code> <span> 130 131 <span> 132 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 133 exception, encapsulating one of the following non-zero errors, or return one 134 of the following non-zero errors: 135 </span> 136 </span> 137 </p> 138 <div class="sect3" lang="en" xml:lang="en"> 139 <div class="titlepage"> 140 <div> 141 <div> 142 <h4 class="title"><a id="id1685436"></a>EINVAL</h4> 143 </div> 144 </div> 145 </div> 146 <p> 147 If supplied buffer was too small to hold the log filename; 148 or if an invalid flag value or parameter was specified. 149 </p> 150 </div> 151 </div> 152 <div class="sect2" lang="en" xml:lang="en"> 153 <div class="titlepage"> 154 <div> 155 <div> 156 <h3 class="title"><a id="id1685437"></a>Class</h3> 157 </div> 158 </div> 159 </div> 160 <p> 161 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a>, 162 <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 163 <a class="link" href="lsn.html" title="Chapter��8.�� The DbLsn Handle">DbLsn</a> 164 </p> 165 </div> 166 <div class="sect2" lang="en" xml:lang="en"> 167 <div class="titlepage"> 168 <div> 169 <div> 170 <h3 class="title"><a id="id1685398"></a>See Also</h3> 171 </div> 172 </div> 173 </div> 174 <p> 175 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 176 </p> 177 </div> 178 </div> 179 <div class="navfooter"> 180 <hr /> 181 <table width="100%" summary="Navigation footer"> 182 <tr> 183 <td width="40%" align="left"><a accesskey="p" href="logcursor.html">Prev</a>��</td> 184 <td width="20%" align="center"> 185 <a accesskey="u" href="lsn.html">Up</a> 186 </td> 187 <td width="40%" align="right">��<a accesskey="n" href="logflush.html">Next</a></td> 188 </tr> 189 <tr> 190 <td width="40%" align="left" valign="top">DbEnv::log_cursor()��</td> 191 <td width="20%" align="center"> 192 <a accesskey="h" href="index.html">Home</a> 193 </td> 194 <td width="40%" align="right" valign="top">��DbEnv::log_flush()</td> 195 </tr> 196 </table> 197 </div> 198 </body> 199</html> 200