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: DbEnv::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>DbEnv::log_put</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 <db_cxx.h> 23<p> 24int 25DbEnv::log_put(DbLsn *lsn, const Dbt *data, u_int32_t flags); 26</pre></b> 27<hr size=1 noshade> 28<b>Description: DbEnv::log_put</b> 29<p>The DbEnv::log_put method appends records to the log. The <a href="../api_cxx/lsn_class.html">DbLsn</a> of 30the put record is returned in the <b>lsn</b> parameter.</p> 31<p>The DbEnv::log_put method 32either returns a non-zero error value 33or throws an exception that encapsulates a non-zero error value on 34failure, and returns 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_cxx/lsn_class.html">DbLsn</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_cxx/lsn_class.html">DbLsn</a> values less than or equal to the 51one being "put" are on disk before DbEnv::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_cxx/lsn_class.html">DbLsn</a> of the put record is copied.</ul> 55<br> 56<br><b>Errors</b> 57<p>The <a href="../api_cxx/log_flush.html">DbEnv::log_flush</a> method 58may fail and throw 59<a href="../api_cxx/except_class.html">DbException</a>, 60encapsulating one of the following non-zero errors, or return one of 61the following non-zero errors:</p> 62<br> 63<b>EINVAL</b><ul compact><li>If the record to be logged is larger than the maximum log record; or if an 64invalid flag value or parameter was specified.</ul> 65<br> 66<hr size=1 noshade> 67<br><b>Class</b> 68<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/logc_class.html">DbLogc</a>, <a href="../api_cxx/lsn_class.html">DbLsn</a> 69<br><b>See Also</b> 70<a href="../api_cxx/log_list.html">Logging Subsystem and Related Methods</a> 71</tt> 72<table width="100%"><tr><td><br></td><td align=right> 73<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> 74</td></tr></table> 75<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 76</body> 77</html> 78