db_set_append_recno.html   [plain text]


<!--$Id: db_set_append_recno.html,v 1.1 2003/02/15 04:55:50 zarzycki Exp $-->
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: Db.set_append_recno</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td>
<h1>Db.set_append_recno</h1>
</td>
<td align=right>
<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
import com.sleepycat.db.*;
<p>
public interface DbAppendRecno
{
    public abstract void db_append_recno(Db db, Dbt data, int recno);
	throws DbException;
}
public class Db
{
    public void set_append_recno(DbAppendRecno db_append_recno)
	throws DbException;
    ...
}
</pre></h3>
<h1>Description</h1>
<p>When using the <a href="../api_java/db_put.html#DB_APPEND">Db.DB_APPEND</a> option of the <a href="../api_java/db_put.html">Db.put</a> method,
it may be useful to modify the stored data based on the generated key.
If a callback method is specified using the
Db.set_append_recno method, it will be called after the record number
has been selected, but before the data has been stored.
The callback function must throw a <a href="../api_java/except_class.html">DbException</a> object to
encapsulate the error on failure.  That object will be thrown to
caller of <a href="../api_java/db_put.html">Db.put</a>.
<p>The called function must take three arguments: a reference to the
enclosing database handle; the data <a href="../api_java/dbt_class.html">Dbt</a> to be stored; and the
selected record number.  The called function may then modify the data
<a href="../api_java/dbt_class.html">Dbt</a>.
<p>The Db.set_append_recno method configures operations performed using the specified
<a href="../api_java/db_class.html">Db</a> handle, not all operations performed on the underlying
database.
<p>The Db.set_append_recno interface may not be called after the <a href="../api_java/db_open.html">Db.open</a>
interface is called.
<p>The Db.set_append_recno method throws an exception that encapsulates a non-zero error value on
failure.
<h1>Class</h1>
<a href="../api_java/db_class.html">Db</a>
<h1>See Also</h1>
<a href="../api_java/db_list.html">Databases and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
</body>
</html>