Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-release > by-pkgid > a4c98df40e78f6c892308fd6841f950a > files > 684

lib64db4.2-devel-4.2.52-11mdv2007.0.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Dec 03 16:22:10 EST 2003 -->
<TITLE>
Dbc (Sleepycat Software, Inc. - Berkeley DB Java API)
</TITLE>
<META NAME="keywords" CONTENT="com.sleepycat.db.Dbc,Dbc class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="Dbc (Sleepycat Software, Inc. - Berkeley DB Java API)";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Dbc.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Berkeley DB</b><br><font size="-1"> version 4.2.52</font></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/sleepycat/db/DbBtreeStat.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/sleepycat/db/DbEnv.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Dbc.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;
<SCRIPT>
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.sleepycat.db</FONT>
<BR>
Class Dbc</H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">java.lang.Object</A>
  |
  +--<B>com.sleepycat.db.Dbc</B>
</PRE>
<HR>
<DL>
<DT>public class <B>Dbc</B><DT>extends <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></DL>

<P>
The Dbc object is the handle for a cursor into a Berkeley DB database. The handle is not free-threaded.  Cursor handles may be used by multiple threads, but only serially, that is, the application must serialize access to the Dbc handle.</p> <p>If the cursor is to be used to perform operations on behalf of a transaction, the cursor must be opened and closed within the context of that single transaction.  Once <A HREF="../../../com/sleepycat/db/Dbc.html#close()"><CODE>Dbc.close</CODE></A> has been called, the handle may not be accessed again, regardless of the method's return.</p>
<P>

<P>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->


<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#close()">close</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.close method discards the cursor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#count(int)">count</A></B>(int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.count method returns a count of the number of data items for the key to which the cursor refers.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#del(int)">del</A></B>(int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Berkeley DB 4.2, replaced by <A HREF="../../../com/sleepycat/db/Dbc.html#delete(int)"><CODE>delete(int)</CODE></A></I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#delete(int)">delete</A></B>(int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.delete method deletes the key/data pair to which the cursor refers.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../com/sleepycat/db/Dbc.html">Dbc</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#dup(int)">dup</A></B>(int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.dup method creates a new cursor that uses the same transaction and locker ID as the original cursor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)">get</A></B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
    <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;pkey,
    <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
    int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.get method retrieves key/data pairs from the database.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)">get</A></B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
    <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
    int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.get method retrieves key/data pairs from the database.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#pget(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)">pget</A></B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
     <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;pkey,
     <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
     int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Replaced in Berkeley DB 4.2 by <A HREF="../../../com/sleepycat/db/Dbc.html#get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><CODE>get(Dbt,Dbt,Dbt,int)</CODE></A></I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/db/Dbc.html#put(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)">put</A></B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
    <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
    int&nbsp;flags)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Dbc.put method stores key/data pairs into the database.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()">toString</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()
           throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.close method discards the cursor.</p> <p>It is possible for the Dbc.close method to return <a href="../../../../ref/program/errorret.html#DB_LOCK_DEADLOCK">Db.DB_LOCK_DEADLOCK</a>, signaling that any enclosing transaction should be aborted.  If the application is already intending to abort the transaction, this error should be ignored, and the application should proceed.</p> <p>After Dbc.close has been called, regardless of its return, the cursor handle may not be used again.</p>
<P>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbDeadlockException.html">DbDeadlockException</A></CODE> - If a transactional database environment operation was selected to resolve a deadlock, the Dbc.close method will fail and throw a <A HREF="../../../com/sleepycat/db/DbDeadlockException.html"><CODE>DbDeadlockException</CODE></A> exception.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html">DbLockNotGrantedException</A></CODE> - If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Dbc.close method will fail and throw a <A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html"><CODE>DbLockNotGrantedException</CODE></A> exception.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.close method will fail and throw a IllegalArgumentException exception if the cursor is already closed; or if an invalid flag value or parameter was specified.</DL>
</DD>
</DL>
<HR>

<A NAME="pget(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><!-- --></A><H3>
pget</H3>
<PRE>
public int <B>pget</B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
                <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;pkey,
                <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
                int&nbsp;flags)
         throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Replaced in Berkeley DB 4.2 by <A HREF="../../../com/sleepycat/db/Dbc.html#get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><CODE>get(Dbt,Dbt,Dbt,int)</CODE></A></I>
<P>
<DD><DL>

<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="count(int)"><!-- --></A><H3>
count</H3>
<PRE>
public int <B>count</B>(int&nbsp;flags)
          throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.count method returns a count of the number of data items for the key to which the cursor refers.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - currently unused, and must be set to 0.
<DT><B>Returns:</B><DD>The Dbc.count method throws an exception that encapsulates a non-zero error value on failure. </p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.count method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors:
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.count method will fail and throw a IllegalArgumentException exception if the cursor has not been initialized; or if an invalid flag value or parameter was specified.</DL>
</DD>
</DL>
<HR>

<A NAME="del(int)"><!-- --></A><H3>
del</H3>
<PRE>
public int <B>del</B>(int&nbsp;flags)
        throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>As of Berkeley DB 4.2, replaced by <A HREF="../../../com/sleepycat/db/Dbc.html#delete(int)"><CODE>delete(int)</CODE></A></I>
<P>
<DD><DL>

<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="delete(int)"><!-- --></A><H3>
delete</H3>
<PRE>
public int <B>delete</B>(int&nbsp;flags)
           throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.delete method deletes the key/data pair to which the cursor refers.</p> <p>When called on a cursor opened on a database that has been made into a secondary index using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method, the <A HREF="../../../com/sleepycat/db/Db.html#delete(com.sleepycat.db.DbTxn, com.sleepycat.db.Dbt, int)"><CODE>Db.delete</CODE></A> method deletes the key/data pair from the primary database and all secondary indices.</p> <p>The cursor position is unchanged after a delete, and subsequent calls to cursor functions expecting the cursor to refer to an existing key will fail.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - currently unused, and must be set to 0.
<DT><B>Returns:</B><DD><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEMPTY"><CODE>DB_KEYEMPTY</CODE></A><p>The Dbc.delete method will return <a href="../../../../ref/program/errorret.html#DB_KEYEMPTY"><code>Db.DB_KEYEMPTY</code></a> if the element has already been deleted. </li></ul>Unless otherwise specified, the Dbc.delete method throws an exception that encapsulates a non-zero error value on failure. </p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.delete method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors: An attempt was made to modify a read-only database. <li>Write attempted on read-only cursor when the <A HREF="../../../com/sleepycat/db/Db.html#DB_INIT_CDB"><CODE>Db.DB_INIT_CDB</CODE></A> flag was specified to <A HREF="../../../com/sleepycat/db/DbEnv.html#open(java.lang.String, int, int)"><CODE>DbEnv.open</CODE></A>.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbDeadlockException.html">DbDeadlockException</A></CODE> - If a transactional database environment operation was selected to resolve a deadlock, the Dbc.delete method will fail and throw a <A HREF="../../../com/sleepycat/db/DbDeadlockException.html"><CODE>DbDeadlockException</CODE></A> exception.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html">DbLockNotGrantedException</A></CODE> - If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Dbc.delete method will fail and throw a <A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html"><CODE>DbLockNotGrantedException</CODE></A> exception.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.delete method will fail and throw a IllegalArgumentException exception if the cursor has not been initialized; or if an invalid flag value or parameter was specified.</DL>
</DD>
</DL>
<HR>

<A NAME="dup(int)"><!-- --></A><H3>
dup</H3>
<PRE>
public <A HREF="../../../com/sleepycat/db/Dbc.html">Dbc</A> <B>dup</B>(int&nbsp;flags)
        throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.dup method creates a new cursor that uses the same transaction and locker ID as the original cursor.  This is useful when an application is using locking and requires two or more cursors in the same thread of control.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flags</CODE> - must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or more of the following values: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_POSITION"><CODE>Db.DB_POSITION</CODE></A><p>The newly created cursor is initialized to refer to the same position in the database as the original cursor and hold the same locks.  If the <code>Db.DB_POSITION</code> flag is not specified, then the created cursor is uninitialized and will behave like a cursor newly created using <A HREF="../../../com/sleepycat/db/Db.html#cursor(com.sleepycat.db.DbTxn, int)"><CODE>Db.cursor</CODE></A>. </li></ul>
<DT><B>Returns:</B><DD>The Dbc.dup method throws an exception that encapsulates a non-zero error value on failure. </p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.dup method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors:
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.dup method will fail and throw a IllegalArgumentException exception if the cursor has not been initialized; or if an invalid flag value or parameter was specified.</DL>
</DD>
</DL>
<HR>

<A NAME="get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><!-- --></A><H3>
get</H3>
<PRE>
public int <B>get</B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
               <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
               int&nbsp;flags)
        throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.get method retrieves key/data pairs from the database.  The byte array and length of the key are returned in the object to which <b>key</b> refers (except for the case of the Db.DB_SET flag, in which the <b>key</b> object is unchanged), and the byte array and length of the data are returned in the object to which <b>data</b> refers.</p> <p>When called on a cursor opened on a database that has been made into a secondary index using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method, the Dbc.get and Dbc.get methods return the key from the secondary index and the data item from the primary database. In addition, the second method signature returns the key from the primary database.  In databases that are not secondary indices, the second method signature will always fail.</p> <p>Modifications to the database during a sequential scan will be reflected in the scan; that is, records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned.</p> <p>In Queue and Recno databases, missing entries (that is, entries that were never explicitly created or that were created and then deleted) will be skipped during a sequential scan.</p> If Dbc.get fails for any reason, the state of the cursor will be unchanged.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.<DD><CODE>flags</CODE> - must be set to one of the following values: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_CURRENT"><CODE>Db.DB_CURRENT</CODE></A><p>Return the key/data pair to which the cursor refers. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_FIRST"><CODE>Db.DB_FIRST</CODE></A><p>The cursor is set to refer to the first key/data pair of the database, and that pair is returned.  If the first key has duplicate values, the first data item in the set of duplicates is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_FIRST</code> flag will ignore any keys that exist but were never explicitly created by the application, or were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_BOTH"><CODE>Db.DB_GET_BOTH</CODE></A><p>The <code>Db.DB_GET_BOTH</code> flag is identical to the <code>Db.DB_SET</code> flag, except that both the key and the data parameters must be matched by the key and data item in the database. <p>When used with the second method signature version of this method on a secondary index handle, both the secondary and primary keys must be matched by the secondary and primary key item in the database.  It is an error to use the <code>Db.DB_GET_BOTH</code> flag with the first method signature version of this method and a cursor that has been opened on a secondary index handle.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_BOTH_RANGE"><CODE>Db.DB_GET_BOTH_RANGE</CODE></A><p>The <code>Db.DB_GET_BOTH_RANGE</code> flag is identical to the <code>Db.DB_GET_BOTH</code> flag, except that, in the case of any database supporting sorted duplicate sets, the returned key/data pair is the smallest data item greater than or equal to the specified data item (as determined by the comparison function), permitting partial matches and range searches in duplicate data sets. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_RECNO"><CODE>Db.DB_GET_RECNO</CODE></A><p>Return the record number associated with the cursor.  The record number will be returned in <b>data</b>, as described in <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A>.  ignored. <p>For <code>Db.DB_GET_RECNO</code> to be specified, the underlying database must be of type Btree, and it must have been created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag.</p> <p>When called on a cursor opened on a database that has been made into a secondary index, the Dbc.get method returns the record number of the primary database in <b>data</b>.  In addition, the second method signature returns the record number of the secondary index in <b>pkey</b>.  If either underlying database is not of type Btree or is not created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag, the out-of-band record number of 0 is returned.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_JOIN_ITEM"><CODE>Db.DB_JOIN_ITEM</CODE></A><p>Do not use the data value found in all of the cursors as a lookup key for the primary database, but simply return it in the key parameter instead. The data parameter is left unchanged. <p>For <code>Db.DB_JOIN_ITEM</code> to be specified, the underlying cursor must have been returned from the <A HREF="../../../com/sleepycat/db/Db.html#join(com.sleepycat.db.Dbc[], int)"><CODE>Db.join</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_LAST"><CODE>Db.DB_LAST</CODE></A><p>The cursor is set to refer to the last key/data pair of the database, and that pair is returned.  If the last key has duplicate values, the last data item in the set of duplicates is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_LAST</code> flag will ignore any keys that exist but were never explicitly created by the application, or were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT"><CODE>Db.DB_NEXT</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_NEXT</code> is identical to <code>Db.DB_FIRST</code>.  Otherwise, the cursor is moved to the next key/data pair of the database, and that pair is returned.  In the presence of duplicate key values, the value of the key may not change. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_NEXT</code> flag will skip any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT_DUP"><CODE>Db.DB_NEXT_DUP</CODE></A><p>If the next key/data pair of the database is a duplicate data record for the current key/data pair, the cursor is moved to the next key/data pair of the database, and that pair is returned. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT_NODUP"><CODE>Db.DB_NEXT_NODUP</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_NEXT_NODUP</code> is identical to <code>Db.DB_FIRST</code>.  Otherwise, the cursor is moved to the next non-duplicate key of the database, and that key/data pair is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_NEXT_NODUP</code> flag will ignore any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_PREV"><CODE>Db.DB_PREV</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_PREV</code> is identical to <code>Db.DB_LAST</code>.  Otherwise, the cursor is moved to the previous key/data pair of the database, and that pair is returned.  In the presence of duplicate key values, the value of the key may not change. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_PREV</code> flag will skip any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_PREV_NODUP"><CODE>Db.DB_PREV_NODUP</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_PREV_NODUP</code> is identical to <code>Db.DB_LAST</code>.  Otherwise, the cursor is moved to the previous non-duplicate key of the database, and that key/data pair is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_PREV_NODUP</code> flag will ignore any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET"><CODE>Db.DB_SET</CODE></A><p>Move the cursor to the specified key/data pair of the database, and return the datum associated with the given key. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET_RANGE"><CODE>Db.DB_SET_RANGE</CODE></A><p>The <code>Db.DB_SET_RANGE</code> flag is identical to the <code>Db.DB_SET</code> flag, except that in the case of the Btree access method, the key is returned as well as the data item and the returned key/data pair is the smallest key greater than or equal to the specified key (as determined by the Btree comparison function), permitting partial key matches and range searches. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET_RECNO"><CODE>Db.DB_SET_RECNO</CODE></A><p>Move the cursor to the specific numbered record of the database, and return the associated key/data pair.  The <b>data</b> field of the specified <b>key</b> must be a byte array containing a record number, as described in <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A>.  This determines the record to be retrieved. <p>For <code>Db.DB_SET_RECNO</code> to be specified, the underlying database must be of type Btree, and it must have been created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag.</p> </li></ul>In addition, the following flags may be set by bitwise inclusively <b>OR</b>'ing them into the <b>flags</b> parameter: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_DIRTY_READ"><CODE>Db.DB_DIRTY_READ</CODE></A><p>Read modified but not yet committed data.  Silently ignored if the <A HREF="../../../com/sleepycat/db/Db.html#DB_DIRTY_READ"><CODE><code>Db.DB_DIRTY_READ</code></CODE></A> flag was not specified when the underlying database was opened. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_MULTIPLE"><CODE>Db.DB_MULTIPLE</CODE></A><p>Return multiple data items in the <b>data</b> parameter. <p>In the case of Btree or Hash databases, duplicate data items for the current key, starting at the current cursor position, are entered into the buffer.  Subsequent calls with both the <code>Db.DB_NEXT_DUP</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional duplicate data items associated with the current key or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional duplicate data items to return.  Subsequent calls with both the <code>Db.DB_NEXT</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional duplicate data items associated with the current key or if there are no additional duplicate data items will return the next key and its data items or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional keys in the database.</p> <p>In the case of Queue or Recno databases, data items starting at the current cursor position are entered into the buffer.  The record number of the first record will be returned in the <b>key</b> parameter.  The record number of each subsequent returned record must be calculated from this value.  Subsequent calls with the <code>Db.DB_MULTIPLE</code> flag specified will return additional data items or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional data items to return.</p> <p>The buffer to which the <b>data</b> parameter refers must be provided from user memory (see <A HREF="../../../com/sleepycat/db/Db.html#DB_DBT_USERMEM"><CODE><code>Db.DB_DBT_USERMEM</code></CODE></A>).  The buffer must be at least as large as the page size of the underlying database, aligned for unsigned integer access, and be a multiple of 1024 bytes in size.  If the buffer size is insufficient, then upon return from the call the size field of the <b>data</b> parameter will have been set to an estimated buffer size, and a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> is thrown.  (The size is an estimate as the exact size needed may not be known until all entries are read.  It is best to initially provide a relatively large buffer, but applications should be prepared to resize the buffer as necessary and repeatedly call the method.)</p> <p>The multiple data items can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleDataIterator.html"><CODE>DbMultipleDataIterator</CODE></A> class.</p> <p>The <code>Db.DB_MULTIPLE</code> flag may only be used with the <code>Db.DB_CURRENT</code>, <code>Db.DB_FIRST</code>, <code>Db.DB_GET_BOTH</code>, <code>Db.DB_GET_BOTH_RANGE</code>, <code>Db.DB_NEXT</code>, <code>Db.DB_NEXT_DUP</code>, <code>Db.DB_NEXT_NODUP</code>, <code>Db.DB_SET</code>, <code>Db.DB_SET_RANGE</code>, and <code>Db.DB_SET_RECNO</code> options.  The <code>Db.DB_MULTIPLE</code> flag may not be used when accessing databases made into secondary indices using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_MULTIPLE_KEY"><CODE>Db.DB_MULTIPLE_KEY</CODE></A><p>Return multiple key and data pairs in the <b>data</b> parameter. <p>Key and data pairs, starting at the current cursor position, are entered into the buffer.  Subsequent calls with both the <code>Db.DB_NEXT</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional key and data pairs or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional key and data items to return.</p> <p>In the case of Btree or Hash databases, the multiple key and data pairs can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleKeyDataIterator.html"><CODE>DbMultipleKeyDataIterator</CODE></A> class.</p> <p>In the case of Queue or Recno databases, the multiple record number and data pairs can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleRecnoDataIterator.html"><CODE>DbMultipleRecnoDataIterator</CODE></A> class.</p> <p>The buffer to which the <b>data</b> parameter refers must be provided from user memory (see <A HREF="../../../com/sleepycat/db/Db.html#DB_DBT_USERMEM"><CODE><code>Db.DB_DBT_USERMEM</code></CODE></A>).  The buffer must be at least as large as the page size of the underlying database, aligned for unsigned integer access, and be a multiple of 1024 bytes in size.  If the buffer size is insufficient, then upon return from the call the size field of the <b>data</b> parameter will have been set to an estimated buffer size, and a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> is thrown.  (The size is an estimate as the exact size needed may not be known until all entries are read.  It is best to initially provide a relatively large buffer, but applications should be prepared to resize the buffer as necessary and repeatedly call the method.)</p> <p>The <code>Db.DB_MULTIPLE_KEY</code> flag may only be used with the <code>Db.DB_CURRENT</code>, <code>Db.DB_FIRST</code>, <code>Db.DB_GET_BOTH</code>, <code>Db.DB_GET_BOTH_RANGE</code>, <code>Db.DB_NEXT</code>, <code>Db.DB_NEXT_DUP</code>, <code>Db.DB_NEXT_NODUP</code>, <code>Db.DB_SET</code>, <code>Db.DB_SET_RANGE</code>, and <code>Db.DB_SET_RECNO</code> options.  The <code>Db.DB_MULTIPLE_KEY</code> flag may not be used when accessing databases made into secondary indices using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_RMW"><CODE>Db.DB_RMW</CODE></A><p>Acquire write locks instead of read locks when doing the retrieval. Setting this flag can eliminate deadlock during a read-modify-write cycle by acquiring the write lock during the read part of the cycle so that another thread of control acquiring a read lock for the same item, in its own read-modify-write cycle, will not result in deadlock. </li></ul><DD><CODE>key</CODE> - The key <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.
<DT><B>Returns:</B><DD>Unless otherwise specified, the Dbc.get method throws an exception that encapsulates a non-zero error value on failure. </p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEMPTY"><CODE>DB_KEYEMPTY</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_KEYEMPTY"><code>Db.DB_KEYEMPTY</code></a> if <code>Db.DB_CURRENT</code> is set and the cursor key/data pair was deleted. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_FIRST</code> is set and the database is empty. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_LAST</code> is set and the database is empty. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT</code> is set and the cursor is already on the last record in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT_DUP</code> is set and the next key/data pair of the database is not a duplicate data record for the current key/data pair. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT_NODUP</code> is set and no non-duplicate key/data pairs occur after the cursor position in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_PREV</code> is set and the cursor is already on the first record in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_PREV_NODUP</code> is set and no non-duplicate key/data pairs occur before the cursor position in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_SET</code> is set and no matching keys are found. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEMPTY"><CODE>DB_KEYEMPTY</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_KEYEMPTY"><code>Db.DB_KEYEMPTY</code></a> if <code>Db.DB_SET</code> is set and the database is a Queue or Recno database, and the specified key exists, but was never explicitly created by the application or was later deleted. </li></ul>In the presence of duplicate key values, Dbc.get will return the first data item for the given key. </p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.get method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors:
<DD><CODE><A HREF="../../../com/sleepycat/db/DbDeadlockException.html">DbDeadlockException</A></CODE> - If a transactional database environment operation was selected to resolve a deadlock, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbDeadlockException.html"><CODE>DbDeadlockException</CODE></A> exception.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html">DbLockNotGrantedException</A></CODE> - If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html"><CODE>DbLockNotGrantedException</CODE></A> exception.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.get method will fail and throw a IllegalArgumentException exception if the Db.DB_CURRENT or Db.DB_NEXT_DUP flags were specified and the cursor has not been initialized; the second method signature was called with a cursor that does not refer to a secondary index; or if an invalid flag value or parameter was specified.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbMemoryException.html">DbMemoryException</A></CODE> - If the requested item could not be returned due to insufficient memory, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> exception.</DL>
</DD>
</DL>
<HR>

<A NAME="get(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><!-- --></A><H3>
get</H3>
<PRE>
public int <B>get</B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
               <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;pkey,
               <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
               int&nbsp;flags)
        throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.get method retrieves key/data pairs from the database.  The byte array and length of the key are returned in the object to which <b>key</b> refers (except for the case of the Db.DB_SET flag, in which the <b>key</b> object is unchanged), and the byte array and length of the data are returned in the object to which <b>data</b> refers.</p> <p>When called on a cursor opened on a database that has been made into a secondary index using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method, the Dbc.get and Dbc.get methods return the key from the secondary index and the data item from the primary database. In addition, the second method signature returns the key from the primary database.  In databases that are not secondary indices, the second method signature will always fail.</p> <p>Modifications to the database during a sequential scan will be reflected in the scan; that is, records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned.</p> <p>In Queue and Recno databases, missing entries (that is, entries that were never explicitly created or that were created and then deleted) will be skipped during a sequential scan.</p> If Dbc.get fails for any reason, the state of the cursor will be unchanged.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.<DD><CODE>flags</CODE> - must be set to one of the following values: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_CURRENT"><CODE>Db.DB_CURRENT</CODE></A><p>Return the key/data pair to which the cursor refers. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_FIRST"><CODE>Db.DB_FIRST</CODE></A><p>The cursor is set to refer to the first key/data pair of the database, and that pair is returned.  If the first key has duplicate values, the first data item in the set of duplicates is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_FIRST</code> flag will ignore any keys that exist but were never explicitly created by the application, or were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_BOTH"><CODE>Db.DB_GET_BOTH</CODE></A><p>The <code>Db.DB_GET_BOTH</code> flag is identical to the <code>Db.DB_SET</code> flag, except that both the key and the data parameters must be matched by the key and data item in the database. <p>When used with the second method signature version of this method on a secondary index handle, both the secondary and primary keys must be matched by the secondary and primary key item in the database.  It is an error to use the <code>Db.DB_GET_BOTH</code> flag with the first method signature version of this method and a cursor that has been opened on a secondary index handle.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_BOTH_RANGE"><CODE>Db.DB_GET_BOTH_RANGE</CODE></A><p>The <code>Db.DB_GET_BOTH_RANGE</code> flag is identical to the <code>Db.DB_GET_BOTH</code> flag, except that, in the case of any database supporting sorted duplicate sets, the returned key/data pair is the smallest data item greater than or equal to the specified data item (as determined by the comparison function), permitting partial matches and range searches in duplicate data sets. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_GET_RECNO"><CODE>Db.DB_GET_RECNO</CODE></A><p>Return the record number associated with the cursor.  The record number will be returned in <b>data</b>, as described in <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A>.  ignored. <p>For <code>Db.DB_GET_RECNO</code> to be specified, the underlying database must be of type Btree, and it must have been created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag.</p> <p>When called on a cursor opened on a database that has been made into a secondary index, the Dbc.get method returns the record number of the primary database in <b>data</b>.  In addition, the second method signature returns the record number of the secondary index in <b>pkey</b>.  If either underlying database is not of type Btree or is not created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag, the out-of-band record number of 0 is returned.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_JOIN_ITEM"><CODE>Db.DB_JOIN_ITEM</CODE></A><p>Do not use the data value found in all of the cursors as a lookup key for the primary database, but simply return it in the key parameter instead. The data parameter is left unchanged. <p>For <code>Db.DB_JOIN_ITEM</code> to be specified, the underlying cursor must have been returned from the <A HREF="../../../com/sleepycat/db/Db.html#join(com.sleepycat.db.Dbc[], int)"><CODE>Db.join</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_LAST"><CODE>Db.DB_LAST</CODE></A><p>The cursor is set to refer to the last key/data pair of the database, and that pair is returned.  If the last key has duplicate values, the last data item in the set of duplicates is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_LAST</code> flag will ignore any keys that exist but were never explicitly created by the application, or were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT"><CODE>Db.DB_NEXT</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_NEXT</code> is identical to <code>Db.DB_FIRST</code>.  Otherwise, the cursor is moved to the next key/data pair of the database, and that pair is returned.  In the presence of duplicate key values, the value of the key may not change. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_NEXT</code> flag will skip any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT_DUP"><CODE>Db.DB_NEXT_DUP</CODE></A><p>If the next key/data pair of the database is a duplicate data record for the current key/data pair, the cursor is moved to the next key/data pair of the database, and that pair is returned. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NEXT_NODUP"><CODE>Db.DB_NEXT_NODUP</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_NEXT_NODUP</code> is identical to <code>Db.DB_FIRST</code>.  Otherwise, the cursor is moved to the next non-duplicate key of the database, and that key/data pair is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_NEXT_NODUP</code> flag will ignore any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_PREV"><CODE>Db.DB_PREV</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_PREV</code> is identical to <code>Db.DB_LAST</code>.  Otherwise, the cursor is moved to the previous key/data pair of the database, and that pair is returned.  In the presence of duplicate key values, the value of the key may not change. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_PREV</code> flag will skip any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_PREV_NODUP"><CODE>Db.DB_PREV_NODUP</CODE></A><p>If the cursor is not yet initialized, <code>Db.DB_PREV_NODUP</code> is identical to <code>Db.DB_LAST</code>.  Otherwise, the cursor is moved to the previous non-duplicate key of the database, and that key/data pair is returned. <p>If the database is a Queue or Recno database, Dbc.get using the <code>Db.DB_PREV_NODUP</code> flag will ignore any keys that exist but were never explicitly created by the application, or those that were created and later deleted.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET"><CODE>Db.DB_SET</CODE></A><p>Move the cursor to the specified key/data pair of the database, and return the datum associated with the given key. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET_RANGE"><CODE>Db.DB_SET_RANGE</CODE></A><p>The <code>Db.DB_SET_RANGE</code> flag is identical to the <code>Db.DB_SET</code> flag, except that in the case of the Btree access method, the key is returned as well as the data item and the returned key/data pair is the smallest key greater than or equal to the specified key (as determined by the Btree comparison function), permitting partial key matches and range searches. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_SET_RECNO"><CODE>Db.DB_SET_RECNO</CODE></A><p>Move the cursor to the specific numbered record of the database, and return the associated key/data pair.  The <b>data</b> field of the specified <b>key</b> must be a byte array containing a record number, as described in <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A>.  This determines the record to be retrieved. <p>For <code>Db.DB_SET_RECNO</code> to be specified, the underlying database must be of type Btree, and it must have been created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RECNUM"><CODE><code>Db.DB_RECNUM</code></CODE></A> flag.</p> </li></ul>In addition, the following flags may be set by bitwise inclusively <b>OR</b>'ing them into the <b>flags</b> parameter: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_DIRTY_READ"><CODE>Db.DB_DIRTY_READ</CODE></A><p>Read modified but not yet committed data.  Silently ignored if the <A HREF="../../../com/sleepycat/db/Db.html#DB_DIRTY_READ"><CODE><code>Db.DB_DIRTY_READ</code></CODE></A> flag was not specified when the underlying database was opened. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_MULTIPLE"><CODE>Db.DB_MULTIPLE</CODE></A><p>Return multiple data items in the <b>data</b> parameter. <p>In the case of Btree or Hash databases, duplicate data items for the current key, starting at the current cursor position, are entered into the buffer.  Subsequent calls with both the <code>Db.DB_NEXT_DUP</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional duplicate data items associated with the current key or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional duplicate data items to return.  Subsequent calls with both the <code>Db.DB_NEXT</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional duplicate data items associated with the current key or if there are no additional duplicate data items will return the next key and its data items or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional keys in the database.</p> <p>In the case of Queue or Recno databases, data items starting at the current cursor position are entered into the buffer.  The record number of the first record will be returned in the <b>key</b> parameter.  The record number of each subsequent returned record must be calculated from this value.  Subsequent calls with the <code>Db.DB_MULTIPLE</code> flag specified will return additional data items or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional data items to return.</p> <p>The buffer to which the <b>data</b> parameter refers must be provided from user memory (see <A HREF="../../../com/sleepycat/db/Db.html#DB_DBT_USERMEM"><CODE><code>Db.DB_DBT_USERMEM</code></CODE></A>).  The buffer must be at least as large as the page size of the underlying database, aligned for unsigned integer access, and be a multiple of 1024 bytes in size.  If the buffer size is insufficient, then upon return from the call the size field of the <b>data</b> parameter will have been set to an estimated buffer size, and a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> is thrown.  (The size is an estimate as the exact size needed may not be known until all entries are read.  It is best to initially provide a relatively large buffer, but applications should be prepared to resize the buffer as necessary and repeatedly call the method.)</p> <p>The multiple data items can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleDataIterator.html"><CODE>DbMultipleDataIterator</CODE></A> class.</p> <p>The <code>Db.DB_MULTIPLE</code> flag may only be used with the <code>Db.DB_CURRENT</code>, <code>Db.DB_FIRST</code>, <code>Db.DB_GET_BOTH</code>, <code>Db.DB_GET_BOTH_RANGE</code>, <code>Db.DB_NEXT</code>, <code>Db.DB_NEXT_DUP</code>, <code>Db.DB_NEXT_NODUP</code>, <code>Db.DB_SET</code>, <code>Db.DB_SET_RANGE</code>, and <code>Db.DB_SET_RECNO</code> options.  The <code>Db.DB_MULTIPLE</code> flag may not be used when accessing databases made into secondary indices using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_MULTIPLE_KEY"><CODE>Db.DB_MULTIPLE_KEY</CODE></A><p>Return multiple key and data pairs in the <b>data</b> parameter. <p>Key and data pairs, starting at the current cursor position, are entered into the buffer.  Subsequent calls with both the <code>Db.DB_NEXT</code> and <code>Db.DB_MULTIPLE</code> flags specified will return additional key and data pairs or <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if there are no additional key and data items to return.</p> <p>In the case of Btree or Hash databases, the multiple key and data pairs can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleKeyDataIterator.html"><CODE>DbMultipleKeyDataIterator</CODE></A> class.</p> <p>In the case of Queue or Recno databases, the multiple record number and data pairs can be iterated over using the <A HREF="../../../com/sleepycat/db/DbMultipleRecnoDataIterator.html"><CODE>DbMultipleRecnoDataIterator</CODE></A> class.</p> <p>The buffer to which the <b>data</b> parameter refers must be provided from user memory (see <A HREF="../../../com/sleepycat/db/Db.html#DB_DBT_USERMEM"><CODE><code>Db.DB_DBT_USERMEM</code></CODE></A>).  The buffer must be at least as large as the page size of the underlying database, aligned for unsigned integer access, and be a multiple of 1024 bytes in size.  If the buffer size is insufficient, then upon return from the call the size field of the <b>data</b> parameter will have been set to an estimated buffer size, and a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> is thrown.  (The size is an estimate as the exact size needed may not be known until all entries are read.  It is best to initially provide a relatively large buffer, but applications should be prepared to resize the buffer as necessary and repeatedly call the method.)</p> <p>The <code>Db.DB_MULTIPLE_KEY</code> flag may only be used with the <code>Db.DB_CURRENT</code>, <code>Db.DB_FIRST</code>, <code>Db.DB_GET_BOTH</code>, <code>Db.DB_GET_BOTH_RANGE</code>, <code>Db.DB_NEXT</code>, <code>Db.DB_NEXT_DUP</code>, <code>Db.DB_NEXT_NODUP</code>, <code>Db.DB_SET</code>, <code>Db.DB_SET_RANGE</code>, and <code>Db.DB_SET_RECNO</code> options.  The <code>Db.DB_MULTIPLE_KEY</code> flag may not be used when accessing databases made into secondary indices using the <A HREF="../../../com/sleepycat/db/Db.html#associate(com.sleepycat.db.DbTxn, com.sleepycat.db.Db, com.sleepycat.db.DbSecondaryKeyCreate, int)"><CODE>Db.associate</CODE></A> method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_RMW"><CODE>Db.DB_RMW</CODE></A><p>Acquire write locks instead of read locks when doing the retrieval. Setting this flag can eliminate deadlock during a read-modify-write cycle by acquiring the write lock during the read part of the cycle so that another thread of control acquiring a read lock for the same item, in its own read-modify-write cycle, will not result in deadlock. </li></ul><DD><CODE>key</CODE> - The key <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.<DD><CODE>pkey</CODE> - The secondary index key <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.
<DT><B>Returns:</B><DD>Unless otherwise specified, the Dbc.get method throws an exception that encapsulates a non-zero error value on failure. </p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEMPTY"><CODE>DB_KEYEMPTY</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_KEYEMPTY"><code>Db.DB_KEYEMPTY</code></a> if <code>Db.DB_CURRENT</code> is set and the cursor key/data pair was deleted. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_FIRST</code> is set and the database is empty. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_LAST</code> is set and the database is empty. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT</code> is set and the cursor is already on the last record in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT_DUP</code> is set and the next key/data pair of the database is not a duplicate data record for the current key/data pair. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_NEXT_NODUP</code> is set and no non-duplicate key/data pairs occur after the cursor position in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_PREV</code> is set and the cursor is already on the first record in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_PREV_NODUP</code> is set and no non-duplicate key/data pairs occur before the cursor position in the database. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if <code>Db.DB_SET</code> is set and no matching keys are found. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEMPTY"><CODE>DB_KEYEMPTY</CODE></A><p>The Dbc.get method will return <a href="../../../../ref/program/errorret.html#DB_KEYEMPTY"><code>Db.DB_KEYEMPTY</code></a> if <code>Db.DB_SET</code> is set and the database is a Queue or Recno database, and the specified key exists, but was never explicitly created by the application or was later deleted. </li></ul>In the presence of duplicate key values, Dbc.get will return the first data item for the given key. </p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.get method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors:
<DD><CODE><A HREF="../../../com/sleepycat/db/DbDeadlockException.html">DbDeadlockException</A></CODE> - If a transactional database environment operation was selected to resolve a deadlock, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbDeadlockException.html"><CODE>DbDeadlockException</CODE></A> exception.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html">DbLockNotGrantedException</A></CODE> - If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html"><CODE>DbLockNotGrantedException</CODE></A> exception.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.get method will fail and throw a IllegalArgumentException exception if the Db.DB_CURRENT or Db.DB_NEXT_DUP flags were specified and the cursor has not been initialized; the second method signature was called with a cursor that does not refer to a secondary index; or if an invalid flag value or parameter was specified.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbMemoryException.html">DbMemoryException</A></CODE> - If the requested item could not be returned due to insufficient memory, the Dbc.get method will fail and throw a <A HREF="../../../com/sleepycat/db/DbMemoryException.html"><CODE>DbMemoryException</CODE></A> exception.</DL>
</DD>
</DL>
<HR>

<A NAME="put(com.sleepycat.db.Dbt, com.sleepycat.db.Dbt, int)"><!-- --></A><H3>
put</H3>
<PRE>
public int <B>put</B>(<A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;key,
               <A HREF="../../../com/sleepycat/db/Dbt.html">Dbt</A>&nbsp;data,
               int&nbsp;flags)
        throws <A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></PRE>
<DL>
<DD>The Dbc.put method stores key/data pairs into the database.</p> If Dbc.put fails for any reason, the state of the cursor will be unchanged.  If Dbc.put succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - The data <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.<DD><CODE>flags</CODE> - must be set to one of the following values: <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_AFTER"><CODE>Db.DB_AFTER</CODE></A><p>In the case of the Btree and Hash access methods, insert the data element as a duplicate element of the key to which the cursor refers. The new element appears immediately after the current cursor position. It is an error to specify <code>Db.DB_AFTER</code> if the underlying Btree or Hash database does not support duplicate data items.  ignored. <p>In the case of the Recno access method, it is an error to specify <code>Db.DB_AFTER</code> if the underlying Recno database was not created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RENUMBER"><CODE><code>Db.DB_RENUMBER</code></CODE></A> flag.  If the <A HREF="../../../com/sleepycat/db/Db.html#DB_RENUMBER"><CODE><code>Db.DB_RENUMBER</code></CODE></A> flag was specified, a new key is created, all records after the inserted item are automatically renumbered, and the key of the new record is returned in the structure to which the <b>key</b> parameter refers.  The initial value of the <b>key</b> parameter is ignored.  See <A HREF="../../../com/sleepycat/db/Db.html#open(com.sleepycat.db.DbTxn, java.lang.String, java.lang.String, int, int, int)"><CODE>Db.open</CODE></A> for more information.</p> <p>The <code>Db.DB_AFTER</code> flag may not be specified to the Queue access method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_BEFORE"><CODE>Db.DB_BEFORE</CODE></A><p>In the case of the Btree and Hash access methods, insert the data element as a duplicate element of the key to which the cursor refers. The new element appears immediately before the current cursor position. It is an error to specify <code>Db.DB_BEFORE</code> if the underlying Btree or Hash database does not support duplicate data items.  ignored. <p>In the case of the Recno access method, it is an error to specify <code>Db.DB_BEFORE</code> if the underlying Recno database was not created with the <A HREF="../../../com/sleepycat/db/Db.html#DB_RENUMBER"><CODE><code>Db.DB_RENUMBER</code></CODE></A> flag.  If the <A HREF="../../../com/sleepycat/db/Db.html#DB_RENUMBER"><CODE><code>Db.DB_RENUMBER</code></CODE></A> flag was specified, a new key is created, the current record and all records after it are automatically renumbered, and the key of the new record is returned in the structure to which the <b>key</b> parameter refers. The initial value of the <b>key</b> parameter is ignored.  See <A HREF="../../../com/sleepycat/db/Db.html#open(com.sleepycat.db.DbTxn, java.lang.String, java.lang.String, int, int, int)"><CODE>Db.open</CODE></A> for more information.</p> <p>The <code>Db.DB_BEFORE</code> flag may not be specified to the Queue access method.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_CURRENT"><CODE>Db.DB_CURRENT</CODE></A><p>Overwrite the data of the key/data pair to which the cursor refers with the specified data item.  ignored. </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYFIRST"><CODE>Db.DB_KEYFIRST</CODE></A><p>In the case of the Btree and Hash access methods, insert the specified key/data pair into the database. <p>If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database and no duplicate sort function has been specified, the inserted data item is added as the first of the data items for that key.</p> <p>The <code>Db.DB_KEYFIRST</code> flag may not be specified to the Queue or Recno access methods.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_KEYLAST"><CODE>Db.DB_KEYLAST</CODE></A><p>In the case of the Btree and Hash access methods, insert the specified key/data pair into the database. <p>If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database, and no duplicate sort function has been specified, the inserted data item is added as the last of the data items for that key.</p> <p>The <code>Db.DB_KEYLAST</code> flag may not be specified to the Queue or Recno access methods.</p> </li></ul><ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NODUPDATA"><CODE>Db.DB_NODUPDATA</CODE></A><p>In the case of the Btree and Hash access methods, insert the specified key/data pair into the database, unless a key/data pair comparing equally to it already exists in the database.  If a matching key/data pair already exists in the database, <A HREF="../../../com/sleepycat/db/Db.html#DB_KEYEXIST"><CODE><code>Db.DB_KEYEXIST</code></CODE></A> is returned. The <code>Db.DB_NODUPDATA</code> flag may only be specified if the underlying database has been configured to support sorted duplicate data items. <p>The <code>Db.DB_NODUPDATA</code> flag may not be specified to the Queue or Recno access methods.</p> </li></ul><DD><CODE>key</CODE> - The key <A HREF="../../../com/sleepycat/db/Dbt.html"><CODE>Dbt</CODE></A> operated on.
<DT><B>Returns:</B><DD>Unless otherwise specified, the Dbc.put method throws an exception that encapsulates a non-zero error value on failure. </p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.put method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if the current cursor record has already been deleted and the underlying access method is Hash. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.put method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if the current cursor record has already been deleted and the underlying access method is Hash. </li></ul></p> <ul><li><A HREF="../../../com/sleepycat/db/Db.html#DB_NOTFOUND"><CODE>DB_NOTFOUND</CODE></A><p>The Dbc.put method will return <a href="../../../../ref/program/errorret.html#DB_NOTFOUND"><code>Db.DB_NOTFOUND</code></a> if the current cursor record has already been deleted and the underlying access method is Hash. </li></ul></p>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html">DbException</A></CODE> - The Dbc.put method may fail and throw <A HREF="../../../com/sleepycat/db/DbException.html"><CODE>DbException</CODE></A>, encapsulating one of the following non-zero errors: <li>An attempt was made to modify a read-only database. Write attempted on read-only cursor when the <A HREF="../../../com/sleepycat/db/Db.html#DB_INIT_CDB"><CODE>Db.DB_INIT_CDB</CODE></A> flag was specified to <A HREF="../../../com/sleepycat/db/DbEnv.html#open(java.lang.String, int, int)"><CODE>DbEnv.open</CODE></A>.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbDeadlockException.html">DbDeadlockException</A></CODE> - If a transactional database environment operation was selected to resolve a deadlock, the Dbc.put method will fail and throw a <A HREF="../../../com/sleepycat/db/DbDeadlockException.html"><CODE>DbDeadlockException</CODE></A> exception.
<DD><CODE><A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html">DbLockNotGrantedException</A></CODE> - If a Berkeley DB Concurrent Data Store database environment configured for lock timeouts was unable to grant a lock in the allowed time, the Dbc.put method will fail and throw a <A HREF="../../../com/sleepycat/db/DbLockNotGrantedException.html"><CODE>DbLockNotGrantedException</CODE></A> exception.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - The Dbc.put method will fail and throw a IllegalArgumentException exception if the Db.DB_AFTER, Db.DB_BEFORE or Db.DB_CURRENT flags were specified and the cursor has not been initialized; the Db.DB_AFTER or Db.DB_BEFORE flags were specified and a duplicate sort function has been specified; the Db.DB_CURRENT flag was specified, a duplicate sort function has been specified, and the data item of the referenced key/data pair does not compare equally to the <b>data</b> parameter; the Db.DB_AFTER or Db.DB_BEFORE flags were specified, and the underlying access method is Queue; an attempt was made to add a record to a fixed-length database that was too large to fit; an attempt was made to add a record to a secondary index; or if an invalid flag value or parameter was specified.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Dbc.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Berkeley DB</b><br><font size="-1"> version 4.2.52</font></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/sleepycat/db/DbBtreeStat.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/sleepycat/db/DbEnv.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Dbc.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;
<SCRIPT>
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<font size=1><a href="../../../../sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</BODY>
</HTML>