<!--$Id: env_set_app_dispatch.so,v 10.54 2004/08/13 03:38:57 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DbEnv::set_app_dispatch</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <h3>DbEnv::set_app_dispatch</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db_cxx.h> <p> int DbEnv::set_app_dispatch(int (*tx_recover)(DbEnv *dbenv, Dbt *log_rec, DbLsn *lsn, db_recops op)); </pre></h3> <hr size=1 noshade> <h3>Description: DbEnv::set_app_dispatch</h3> <p>Declare a function to be called during transaction abort and recovery to process application-specific log records.</p> <p>The DbEnv::set_app_dispatch method configures operations performed using the specified <a href="../../db46-devel-4.6.21/api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying database environment.</p> <p>The DbEnv::set_app_dispatch method may not be called after the <a href="../../db46-devel-4.6.21/api_cxx/env_open.html">DbEnv::open</a> method is called. If the database environment already exists when <a href="../../db46-devel-4.6.21/api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_app_dispatch must be consistent with the existing environment or corruption can occur.</p> <p>The DbEnv::set_app_dispatch method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success. </p> <h3>Parameters</h3> <dl compact> <dt><b>tx_recover</b><dd>The <b>tx_recover</b> parameter is the application's abort and recovery function. The function takes four parameters: <dl compact> <dt><b>dbenv</b><dd>The <b>dbenv</b> parameter is the enclosing database environment handle. <dt><b>log_rec</b><dd>The <b>log_rec</b> parameter is a log record. <dt><b>lsn</b><dd>The <b>lsn</b> parameter is a log sequence number. <dt><b>op</b><dd>The <b>op</b> parameter is one of the following values: <dl compact> <dt><a name="DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a><dd>The log is being read backward to determine which transactions have been committed and to abort those operations that were not; undo the operation described by the log record. <dt><a name="DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a><dd>The log is being played forward; redo the operation described by the log record. <dt><a name="DB_TXN_ABORT">DB_TXN_ABORT</a><dd>The log is being read backward during a transaction abort; undo the operation described by the log record. <dt><a name="DB_TXN_APPLY">DB_TXN_APPLY</a><dd>The log is being applied on a replica site; redo the operation described by the log record. <dt><a name="DB_TXN_PRINT">DB_TXN_PRINT</a><dd>The log is being printed for debugging purposes; print the contents of this log record in the desired format. </dl> <p>The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations frequently imply the same actions, redoing changes that appear in the log record, although if a recovery function is to be used on a replication client where reads may be taking place concurrently with the processing of incoming messages, DB_TXN_APPLY operations should also perform appropriate locking. The macro DB_REDO(op) checks that the operation is one of DB_TXN_FORWARD_ROLL or DB_TXN_APPLY, and should be used in the recovery code to refer to the conditions under which operations should be redone. Similarly, the macro DB_UNDO(op) checks if the operation is one of DB_TXN_BACKWARD_ROLL or DB_TXN_ABORT.</p> </dl> <p>The function must return 0 on success and either <b>errno</b> or a value outside of the Berkeley DB error name space on failure.</p> </dl> <h3>Errors</h3> <p>The DbEnv::set_app_dispatch method may fail and throw <a href="../../db46-devel-4.6.21/api_cxx/except_class.html">DbException</a>, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:</p> <dl compact> <dt>EINVAL<dd>If the method was called after <a href="../../db46-devel-4.6.21/api_cxx/env_open.html">DbEnv::open</a> was called; or if an invalid flag value or parameter was specified. </dl> <hr size=1 noshade> <h3>Class</h3> <a href="../../db46-devel-4.6.21/api_cxx/env_class.html">DbEnv</a>, <a href="../../db46-devel-4.6.21/api_cxx/txn_class.html">DbTxn</a> <h3>See Also</h3> <a href="../../db46-devel-4.6.21/api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>