Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > 636b2a8b77acacd6717dd7e72eda4c1d > files > 384

db6.1-java-devel-6.1.29.0-1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_75) on Fri May 13 13:32:16 PDT 2016 -->
<title>JoinCursor (Oracle - Berkeley DB Java API)</title>
<meta name="date" content="2016-05-13">
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="JoinCursor (Oracle - Berkeley DB Java API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JoinCursor.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/sleepycat/db/KeyRange.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/sleepycat/db/JoinCursor.html" target="_top">Frames</a></li>
<li><a href="JoinCursor.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.sleepycat.db</div>
<h2 title="Class JoinCursor" class="title">Class JoinCursor</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.sleepycat.db.JoinCursor</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">JoinCursor</span>
extends java.lang.Object</pre>
<div class="block">A specialized join cursor for use in performing equality or natural joins on
secondary indices.
<p>
A join cursor is returned when calling <a href="../../../com/sleepycat/db/Database.html#join(com.sleepycat.db.Cursor[],%20com.sleepycat.db.JoinConfig)"><code>Database.join</code></a>.
<p>
To open a join cursor using two secondary cursors:
<pre>
    Transaction txn = ...
    Database primaryDb = ...
    SecondaryDatabase secondaryDb1 = ...
    SecondaryDatabase secondaryDb2 = ...
    <p>
    SecondaryCursor cursor1 = null;
    SecondaryCursor cursor2 = null;
    JoinCursor joinCursor = null;
    try {
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry data = new DatabaseEntry();
        <p>
        cursor1 = secondaryDb1.openSecondaryCursor(txn, null);
        cursor2 = secondaryDb2.openSecondaryCursor(txn, null);
        <p>
        key.setData(...); // initialize key for secondary index 1
        OperationStatus status1 =
        cursor1.getSearchKey(key, data, LockMode.DEFAULT);
        key.setData(...); // initialize key for secondary index 2
        OperationStatus status2 =
        cursor2.getSearchKey(key, data, LockMode.DEFAULT);
        <p>
        if (status1 == OperationStatus.SUCCESS &amp;&amp;
                status2 == OperationStatus.SUCCESS) {
            <p>
            SecondaryCursor[] cursors = {cursor1, cursor2};
            joinCursor = primaryDb.join(cursors, null);
            <p>
            while (true) {
                OperationStatus joinStatus = joinCursor.getNext(key, data,
                    LockMode.DEFAULT);
                if (joinStatus == OperationStatus.SUCCESS) {
                     // Do something with the key and data.
                } else {
                    break;
                }
            }
        }
    } finally {
        if (cursor1 != null) {
            cursor1.close();
        }
        if (cursor2 != null) {
            cursor2.close();
        }
        if (joinCursor != null) {
            joinCursor.close();
        }
    }
</pre></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../com/sleepycat/db/JoinCursor.html#close()">close</a></strong>()</code>
<div class="block">Closes the cursors that have been opened by this join cursor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db">JoinConfig</a></code></td>
<td class="colLast"><code><strong><a href="../../../com/sleepycat/db/JoinCursor.html#getConfig()">getConfig</a></strong>()</code>
<div class="block">Returns this object's configuration.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</a></code></td>
<td class="colLast"><code><strong><a href="../../../com/sleepycat/db/JoinCursor.html#getDatabase()">getDatabase</a></strong>()</code>
<div class="block">Returns the primary database handle associated with this cursor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</a></code></td>
<td class="colLast"><code><strong><a href="../../../com/sleepycat/db/JoinCursor.html#getNext(com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.LockMode)">getNext</a></strong>(<a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;key,
       <a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;data,
       <a href="../../../com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</a>&nbsp;lockMode)</code>
<div class="block">Returns the next primary key and data resulting from the join operation.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</a></code></td>
<td class="colLast"><code><strong><a href="../../../com/sleepycat/db/JoinCursor.html#getNext(com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.LockMode)">getNext</a></strong>(<a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;key,
       <a href="../../../com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</a>&nbsp;lockMode)</code>
<div class="block">Returns the next primary key resulting from the join operation.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="close()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public&nbsp;void&nbsp;close()
           throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
<div class="block">Closes the cursors that have been opened by this join cursor.
    <p>
    The cursors passed to <a href="../../../com/sleepycat/db/Database.html#join(com.sleepycat.db.Cursor[],%20com.sleepycat.db.JoinConfig)"><code>Database.join</code></a> are not closed
    by this method, and should be closed by the caller.
    <p>
    <p></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl>
</li>
</ul>
<a name="getDatabase()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDatabase</h4>
<pre>public&nbsp;<a href="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</a>&nbsp;getDatabase()</pre>
<div class="block">Returns the primary database handle associated with this cursor.
    <p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the primary database handle associated with this cursor.</dd></dl>
</li>
</ul>
<a name="getConfig()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConfig</h4>
<pre>public&nbsp;<a href="../../../com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db">JoinConfig</a>&nbsp;getConfig()</pre>
<div class="block">Returns this object's configuration.
    <p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>this object's configuration.</dd></dl>
</li>
</ul>
<a name="getNext(com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNext</h4>
<pre>public&nbsp;<a href="../../../com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</a>&nbsp;getNext(<a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;key,
                      <a href="../../../com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</a>&nbsp;lockMode)
                        throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
<div class="block">Returns the next primary key resulting from the join operation.
<p>
An entry is returned by the join cursor for each primary key/data pair having
all secondary key values that were specified using the array of secondary
cursors passed to <a href="../../../com/sleepycat/db/Database.html#join(com.sleepycat.db.Cursor[],%20com.sleepycat.db.JoinConfig)"><code>Database.join</code></a>.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - the primary key
returned as output.  Its byte array does not need to be initialized by the
caller.
<p></dd><dd><code>lockMode</code> - the locking attributes; if null, default attributes are used.
<p></dd>
<dt><span class="strong">Returns:</span></dt><dd><a href="../../../com/sleepycat/db/OperationStatus.html#NOTFOUND"><code>OperationStatus.NOTFOUND</code></a> if no matching key/data pair is
found; <a href="../../../com/sleepycat/db/OperationStatus.html#KEYEMPTY"><code>OperationStatus.KEYEMPTY</code></a> if 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; otherwise, <a href="../../../com/sleepycat/db/OperationStatus.html#SUCCESS"><code>OperationStatus.SUCCESS</code></a>.
<p></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
<p></dd>
<dd><code><a href="../../../com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</a></code> - if the operation was selected to resolve a
deadlock.
<p></dd>
<dd><code>java.lang.IllegalArgumentException</code> - if an invalid parameter was specified.
<p></dd>
<dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl>
</li>
</ul>
<a name="getNext(com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getNext</h4>
<pre>public&nbsp;<a href="../../../com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</a>&nbsp;getNext(<a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;key,
                      <a href="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a>&nbsp;data,
                      <a href="../../../com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</a>&nbsp;lockMode)
                        throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
<div class="block">Returns the next primary key and data resulting from the join operation.
<p>
An entry is returned by the join cursor for each primary key/data pair having
all secondary key values that were specified using the array of secondary
cursors passed to <a href="../../../com/sleepycat/db/Database.html#join(com.sleepycat.db.Cursor[],%20com.sleepycat.db.JoinConfig)"><code>Database.join</code></a>.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - the primary key
returned as output.  Its byte array does not need to be initialized by the
caller.
<p></dd><dd><code>data</code> - the primary data
returned as output.  Its byte array does not need to be initialized by the
caller.
<p></dd><dd><code>lockMode</code> - the locking attributes; if null, default attributes are used.
<p></dd>
<dt><span class="strong">Returns:</span></dt><dd><a href="../../../com/sleepycat/db/OperationStatus.html#NOTFOUND"><code>OperationStatus.NOTFOUND</code></a> if no matching key/data pair is
found; <a href="../../../com/sleepycat/db/OperationStatus.html#KEYEMPTY"><code>OperationStatus.KEYEMPTY</code></a> if 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; otherwise, <a href="../../../com/sleepycat/db/OperationStatus.html#SUCCESS"><code>OperationStatus.SUCCESS</code></a>.
<p></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if a DatabaseEntry parameter is null or
does not contain a required non-null byte array.
<p></dd>
<dd><code><a href="../../../com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</a></code> - if the operation was selected to resolve a
deadlock.
<p></dd>
<dd><code>java.lang.IllegalArgumentException</code> - if an invalid parameter was specified.
<p></dd>
<dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JoinCursor.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/sleepycat/db/KeyRange.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/sleepycat/db/JoinCursor.html" target="_top">Frames</a></li>
<li><a href="JoinCursor.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size=1>Copyright (c) 1996, 2016 Oracle and/or its affiliates.  All rights reserved.</font></small></p>
</body>
</html>