mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
351 lines
14 KiB
HTML
351 lines
14 KiB
HTML
<!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 (11.0.7) on Mon Jun 01 06:40:53 PDT 2020 -->
|
|
<title>SecondaryMultiKeyCreator (Oracle - Berkeley DB Java API)</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="date" content="2020-06-01">
|
|
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
|
|
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
|
|
<!--[if IE]>
|
|
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
|
|
<![endif]-->
|
|
<script type="text/javascript" src="../../../jquery/jquery-3.4.1.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="SecondaryMultiKeyCreator (Oracle - Berkeley DB Java API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var data = {"i0":6};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
var pathtoroot = "../../../";
|
|
var useModuleDirectories = true;
|
|
loadScripts(document, 'script');</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<div class="fixedNav">
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/SecondaryMultiKeyCreator.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"><b>Berkeley DB</b><br><font size="-1"> version 18.1.40</font></div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses.html">All Classes</a></li>
|
|
</ul>
|
|
<ul class="navListSearch">
|
|
<li><label for="search">SEARCH:</label>
|
|
<input type="text" id="search" value="search" disabled="disabled">
|
|
<input type="reset" id="reset" value="reset" disabled="disabled">
|
|
</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>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
</div>
|
|
<div class="navPadding"> </div>
|
|
<script type="text/javascript"><!--
|
|
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
|
|
//-->
|
|
</script>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">com.sleepycat.db</a></div>
|
|
<h2 title="Interface SecondaryMultiKeyCreator" class="title">Interface SecondaryMultiKeyCreator</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<pre>public interface <span class="typeNameLabel">SecondaryMultiKeyCreator</span></pre>
|
|
<div class="block">The interface implemented for extracting multi-valued secondary keys from
|
|
primary records.
|
|
<p>
|
|
The key creator object is specified by calling
|
|
<a href="SecondaryConfig.html#setMultiKeyCreator-com.sleepycat.db.SecondaryMultiKeyCreator-"><code>SecondaryConfig.setMultiKeyCreator</code></a>.
|
|
The secondary database configuration is specified when calling
|
|
<a href="Environment.html#openSecondaryDatabase-com.sleepycat.db.Transaction-java.lang.String-java.lang.String-com.sleepycat.db.Database-com.sleepycat.db.SecondaryConfig-"><code>Environment.openSecondaryDatabase</code></a>.
|
|
<p>
|
|
For example:
|
|
<pre>
|
|
class MyMultiKeyCreator implements SecondaryMultiKeyCreator {
|
|
public void createSecondaryKeys(SecondaryDatabase secondary,
|
|
DatabaseEntry key,
|
|
DatabaseEntry data,
|
|
Set results)
|
|
throws DatabaseException {
|
|
//
|
|
// DO HERE: Extract the secondary keys from the primary key and
|
|
// data. For each key extracted, create a DatabaseEntry and add it
|
|
// to the results set.
|
|
//
|
|
}
|
|
}
|
|
...
|
|
SecondaryConfig secConfig = new SecondaryConfig();
|
|
secConfig.setMultiKeyCreator(new MyMultiKeyCreator());
|
|
// Now pass secConfig to Environment.openSecondaryDatabase
|
|
</pre>
|
|
<p>
|
|
Use this interface when any number of secondary keys may be present in a single
|
|
primary record, in other words, for many-to-many and one-to-many relationships.
|
|
When only zero or one secondary key is present (for many-to-one and one-to-one
|
|
relationships) you may use the <a href="SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryKeyCreator</code></a> interface instead.
|
|
The table below summarizes how to create all four variations of relationships.
|
|
<div>
|
|
<table border="yes">
|
|
<caption>Summary of four variations of relationships</caption>
|
|
<tr><th>Relationship</th>
|
|
<th>Interface</th>
|
|
<th>Duplicates</th>
|
|
<th>Example</th>
|
|
</tr>
|
|
<tr><td>One-to-one</td>
|
|
<td><a href="SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryKeyCreator</code></a></td>
|
|
<td>No</td>
|
|
<td>A person record with a unique social security number key.</td>
|
|
</tr>
|
|
<tr><td>Many-to-one</td>
|
|
<td><a href="SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryKeyCreator</code></a></td>
|
|
<td>Yes</td>
|
|
<td>A person record with a non-unique employer key.</td>
|
|
</tr>
|
|
<tr><td>One-to-many</td>
|
|
<td><a href="SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryMultiKeyCreator</code></a></td>
|
|
<td>No</td>
|
|
<td>A person record with multiple unique email address keys.</td>
|
|
</tr>
|
|
<tr><td>Many-to-many</td>
|
|
<td><a href="SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryMultiKeyCreator</code></a></td>
|
|
<td>Yes</td>
|
|
<td>A person record with multiple non-unique organization keys.</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<p>To configure a database for duplicates. pass true to <a href="DatabaseConfig.html#setSortedDuplicates-boolean-"><code>DatabaseConfig.setSortedDuplicates(boolean)</code></a>.</p>
|
|
<p>
|
|
Note that <code>SecondaryMultiKeyCreator</code> may also be used for single key
|
|
secondaries (many-to-one and one-to-one); in this case, at most a single key is
|
|
added to the results set. <code>SecondaryMultiKeyCreator</code> is only
|
|
slightly less efficient than <a href="SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><code>SecondaryKeyCreator</code></a> in that two or three
|
|
temporary sets must be created to hold the results.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="SecondaryConfig.html" title="class in com.sleepycat.db"><code>SecondaryConfig</code></a></dd>
|
|
</dl>
|
|
</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="memberSummary" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colSecond" scope="col">Method</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createSecondaryKeys-com.sleepycat.db.SecondaryDatabase-com.sleepycat.db.DatabaseEntry-com.sleepycat.db.DatabaseEntry-java.util.Set-">createSecondaryKeys</a></span>​(<a href="SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</a> secondary,
|
|
<a href="DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a> key,
|
|
<a href="DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a> data,
|
|
java.util.Set results)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a secondary key entry, given a primary key and data entry.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</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="createSecondaryKeys-com.sleepycat.db.SecondaryDatabase-com.sleepycat.db.DatabaseEntry-com.sleepycat.db.DatabaseEntry-java.util.Set-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>createSecondaryKeys</h4>
|
|
<pre class="methodSignature">void createSecondaryKeys​(<a href="SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</a> secondary,
|
|
<a href="DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a> key,
|
|
<a href="DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</a> data,
|
|
java.util.Set results)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Creates a secondary key entry, given a primary key and data entry.
|
|
<p>
|
|
A secondary key may be derived from the primary key, primary data, or a
|
|
combination of the primary key and data. Zero or more secondary keys may
|
|
be derived from the primary record and returned in the results parameter.
|
|
To ensure the integrity of a secondary database the key creator method must
|
|
always return the same results for a given set of input parameters.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>secondary</code> - the database to which the secondary key will be added.
|
|
This parameter is passed for informational purposes but is not commonly
|
|
used.
|
|
<p></dd>
|
|
<dd><code>key</code> - the primary key entry. This parameter must not be modified
|
|
by this method.
|
|
<p></dd>
|
|
<dd><code>data</code> - the primary data entry. This parameter must not be modified
|
|
by this method.
|
|
<p></dd>
|
|
<dd><code>results</code> - the set to contain the the secondary key DatabaseEntry
|
|
objects created by this method.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if an error occurs attempting to create the
|
|
secondary key.</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>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/SecondaryMultiKeyCreator.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"><b>Berkeley DB</b><br><font size="-1"> version 18.1.40</font></div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses.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>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </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, 2020 Oracle and/or its affiliates. All rights reserved.</font></small></p>
|
|
</body>
|
|
</html>
|