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