1<!--$Id: log_put.so,v 10.41 2004/08/13 03:38:57 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;log_put</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;log_put</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;log_put(DB_ENV *env,
26    DB_LSN *lsn, const DBT *data, u_int32_t flags);
27</pre></b>
28<hr size=1 noshade>
29<b>Description: DB_ENV-&gt;log_put</b>
30<p>The DB_ENV-&gt;log_put method appends records to the log.  The <a href="/api_c/lsn_class.html">DB_LSN</a> of
31the put record is returned in the <b>lsn</b> parameter.</p>
32<p>The DB_ENV-&gt;log_put method
33returns a non-zero error value on failure
34and 0 on success.
35</p>
36<b>Parameters</b> <br>
37 <b>data</b><ul compact><li>The <b>data</b> parameter is the record to write to the log.
38<p>The caller is responsible for providing any necessary structure to
39<b>data</b>.  (For example, in a write-ahead logging protocol, the
40application must understand what part of <b>data</b> is an operation
41code, what part is redo information, and what part is undo information.
42In addition, most transaction managers will store in <b>data</b> the
43<a href="/api_c/lsn_class.html">DB_LSN</a> of the previous log record for the same transaction, to
44support chaining back through the transaction's log records during
45undo.)</p></ul>
46 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
47the following value:
48<br>
49<b><a name="DB_FLUSH">DB_FLUSH</a></b><ul compact><li>The log is forced to disk after this record is written, guaranteeing
50that all records with <a href="/api_c/lsn_class.html">DB_LSN</a> values less than or equal to the
51one being "put" are on disk before DB_ENV-&gt;log_put returns.</ul>
52<br></ul>
53 <b>lsn</b><ul compact><li>The <b>lsn</b> parameter references memory into which
54 the <a href="/api_c/lsn_class.html">DB_LSN</a> of the put record is copied.</ul> 
55<br>
56<br><b>Errors</b>
57<p>The <a href="/api_c/log_flush.html">DB_ENV-&gt;log_flush</a> method
58may fail and return one of the following non-zero errors:</p>
59<br>
60<b>EINVAL</b><ul compact><li>If the record to be logged is larger than the maximum log record; or if an
61invalid flag value or parameter was specified.</ul>
62<br>
63<hr size=1 noshade>
64<br><b>Class</b>
65<a href="/api_c/env_class.html">DB_ENV</a>, <a href="/api_c/logc_class.html">DB_LOGC</a>, <a href="/api_c/lsn_class.html">DB_LSN</a>
66<br><b>See Also</b>
67<a href="/api_c/log_list.html">Logging Subsystem and Related Methods</a>
68</tt>
69<table width="100%"><tr><td><br></td><td align=right>
70<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>
71</td></tr></table>
72<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
73</body>
74</html>
75