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_put()</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="logprintf.html" title="DbEnv::log_printf()" /> 12 <link rel="next" href="envlog_set_config.html" title="DbEnv::log_set_config()" /> 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_put()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="logprintf.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="envlog_set_config.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="logput"></a>DbEnv::log_put()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::log_put(DbLsn *lsn, const Dbt *data, u_int32_t flags);</pre> 42 <p> 43 The <code class="methodname">DbEnv::log_put()</code> method appends records to the log. The 44 <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the put record is 45 returned in the <span class="bold"><strong>lsn</strong></span> parameter. 46 </p> 47 <p> 48 The <code class="methodname">DbEnv::log_put()</code> <span> 49 50 <span> 51 method either returns a non-zero error value or throws an 52 exception that encapsulates a non-zero error value on 53 failure, and returns 0 on success. 54 </span> 55 </span> 56 </p> 57 <div class="sect2" lang="en" xml:lang="en"> 58 <div class="titlepage"> 59 <div> 60 <div> 61 <h3 class="title"><a id="id1685860"></a>Parameters</h3> 62 </div> 63 </div> 64 </div> 65 <div class="sect3" lang="en" xml:lang="en"> 66 <div class="titlepage"> 67 <div> 68 <div> 69 <h4 class="title"><a id="id1686164"></a>data</h4> 70 </div> 71 </div> 72 </div> 73 <p> 74 The <span class="bold"><strong>data</strong></span> parameter is the record to 75 write to the log. 76 </p> 77 <p> 78 The caller is responsible for providing any necessary structure to 79 <span class="bold"><strong>data</strong></span>. (For example, in a write-ahead 80 logging protocol, the application must understand what part of 81 <span class="bold"><strong>data</strong></span> is an operation code, what part 82 is redo information, and what part is undo information. In addition, 83 most transaction managers will store in <span class="bold"><strong>data</strong></span> the 84 <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of the previous log 85 record for the same transaction, to support chaining back through the 86 transaction's log records during undo.) 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="id1686357"></a>flags</h4> 94 </div> 95 </div> 96 </div> 97 <p> 98 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 99 or the following value: 100 </p> 101 <div class="itemizedlist"> 102 <ul type="disc"> 103 <li> 104 <p><a id="put_DB_FLUSH"></a> 105 <code class="literal">DB_FLUSH</code> 106 </p> 107 <p> 108 The log is forced to disk after this record is written, guaranteeing 109 that all records with <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> 110 values less than or equal to the one being "put" are on disk 111 before <code class="methodname">DbEnv::log_put()</code> returns. 112 </p> 113 </li> 114 </ul> 115 </div> 116 </div> 117 <div class="sect3" lang="en" xml:lang="en"> 118 <div class="titlepage"> 119 <div> 120 <div> 121 <h4 class="title"><a id="id1686518"></a>lsn</h4> 122 </div> 123 </div> 124 </div> 125 <p> 126 The <span class="bold"><strong>lsn</strong></span> parameter references memory 127 into which the <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> of 128 the put record is copied. 129 </p> 130 </div> 131 </div> 132 <div class="sect2" lang="en" xml:lang="en"> 133 <div class="titlepage"> 134 <div> 135 <div> 136 <h3 class="title"><a id="id1686371"></a>Errors</h3> 137 </div> 138 </div> 139 </div> 140 <p> 141 The <code class="methodname">DbEnv::log_put()</code> <span> 142 143 <span> 144 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 145 exception, encapsulating one of the following non-zero errors, or return one 146 of the following non-zero errors: 147 </span> 148 </span> 149 </p> 150 <div class="sect3" lang="en" xml:lang="en"> 151 <div class="titlepage"> 152 <div> 153 <div> 154 <h4 class="title"><a id="id1686403"></a>EINVAL</h4> 155 </div> 156 </div> 157 </div> 158 <p> 159 If the record to be logged is larger than the maximum log record; or 160 if an invalid flag value or parameter was specified. 161 </p> 162 </div> 163 </div> 164 <div class="sect2" lang="en" xml:lang="en"> 165 <div class="titlepage"> 166 <div> 167 <div> 168 <h3 class="title"><a id="id1686404"></a>Class</h3> 169 </div> 170 </div> 171 </div> 172 <p> 173 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, 174 <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 175 <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> 176 </p> 177 </div> 178 <div class="sect2" lang="en" xml:lang="en"> 179 <div class="titlepage"> 180 <div> 181 <div> 182 <h3 class="title"><a id="id1686213"></a>See Also</h3> 183 </div> 184 </div> 185 </div> 186 <p> 187 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 188 </p> 189 </div> 190 </div> 191 <div class="navfooter"> 192 <hr /> 193 <table width="100%" summary="Navigation footer"> 194 <tr> 195 <td width="40%" align="left"><a accesskey="p" href="logprintf.html">Prev</a> </td> 196 <td width="20%" align="center"> 197 <a accesskey="u" href="lsn.html">Up</a> 198 </td> 199 <td width="40%" align="right"> <a accesskey="n" href="envlog_set_config.html">Next</a></td> 200 </tr> 201 <tr> 202 <td width="40%" align="left" valign="top">DbEnv::log_printf() </td> 203 <td width="20%" align="center"> 204 <a accesskey="h" href="index.html">Home</a> 205 </td> 206 <td width="40%" align="right" valign="top"> DbEnv::log_set_config()</td> 207 </tr> 208 </table> 209 </div> 210 </body> 211</html> 212