• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/docs/java/com/sleepycat/db/
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:32 EDT 2008 -->
6<TITLE>
7SecondaryMultiKeyCreator (Oracle - Berkeley DB Java API)
8</TITLE>
9
10<META NAME="keywords" CONTENT="com.sleepycat.db.SecondaryMultiKeyCreator interface">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    parent.document.title="SecondaryMultiKeyCreator (Oracle - Berkeley DB Java API)";
18}
19</SCRIPT>
20<NOSCRIPT>
21</NOSCRIPT>
22
23</HEAD>
24
25<BODY BGCOLOR="white" onload="windowTitle();">
26
27
28<!-- ========= START OF TOP NAVBAR ======= -->
29<A NAME="navbar_top"><!-- --></A>
30<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32<TR>
33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34<A NAME="navbar_top_firstrow"><!-- --></A>
35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36  <TR ALIGN="center" VALIGN="top">
37  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/SecondaryMultiKeyCreator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
45  </TR>
46</TABLE>
47</TD>
48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
50</TD>
51</TR>
52
53<TR>
54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
55&nbsp;<A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A>&nbsp;
56&nbsp;<A HREF="../../../com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58  <A HREF="../../../index.html?com/sleepycat/db/SecondaryMultiKeyCreator.html" target="_top"><B>FRAMES</B></A>  &nbsp;
59&nbsp;<A HREF="SecondaryMultiKeyCreator.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
60&nbsp;<SCRIPT type="text/javascript">
61  <!--
62  if(window==top) {
63    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
64  }
65  //-->
66</SCRIPT>
67<NOSCRIPT>
68  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
69</NOSCRIPT>
70
71
72</FONT></TD>
73</TR>
74<TR>
75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
76  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
78DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
79</TR>
80</TABLE>
81<A NAME="skip-navbar_top"></A>
82<!-- ========= END OF TOP NAVBAR ========= -->
83
84<HR>
85<!-- ======== START OF CLASS DATA ======== -->
86<H2>
87<FONT SIZE="-1">
88com.sleepycat.db</FONT>
89<BR>
90Interface SecondaryMultiKeyCreator</H2>
91<HR>
92<DL>
93<DT><PRE>public interface <B>SecondaryMultiKeyCreator</B></DL>
94</PRE>
95
96<P>
97The interface implemented for extracting multi-valued secondary keys from
98primary records.
99<p>
100The key creator object is specified by calling
101<A HREF="../../../com/sleepycat/db/SecondaryConfig.html#setMultiKeyCreator(com.sleepycat.db.SecondaryMultiKeyCreator)"><CODE>SecondaryConfig.setMultiKeyCreator</CODE></A>.
102The secondary database configuration is specified when calling
103<A HREF="../../../com/sleepycat/db/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>.
104<p>
105For example:
106<pre>
107    class MyMultiKeyCreator implements SecondaryMultiKeyCreator {
108    public void createSecondaryKeys(SecondaryDatabase secondary,
109                                        DatabaseEntry key,
110                                        DatabaseEntry data,
111                                        Set results)
112            throws DatabaseException {
113            //
114            // DO HERE: Extract the secondary keys from the primary key and
115            // data.  For each key extracted, create a DatabaseEntry and add it
116            // to the results set.
117            //
118        }
119    }
120    ...
121    SecondaryConfig secConfig = new SecondaryConfig();
122    secConfig.setMultiKeyCreator(new MyMultiKeyCreator());
123    // Now pass secConfig to Environment.openSecondaryDatabase
124</pre>
125<p>
126Use this interface when any number of secondary keys may be present in a single
127primary record, in other words, for many-to-many and one-to-many relationships.
128When only zero or one secondary key is present (for many-to-one and one-to-one
129relationships) you may use the <A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A> interface instead.
130The table below summarizes how to create all four variations of relationships.
131<div>
132<table border="yes">
133    <tr><th>Relationship</th>
134        <th>Interface</th>
135        <th>Duplicates</th>
136        <th>Example</th>
137    </tr>
138    <tr><td>One-to-one</td>
139        <td><A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A></td>
140        <td>No</td>
141        <td>A person record with a unique social security number key.</td>
142    </tr>
143    <tr><td>Many-to-one</td>
144        <td><A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A></td>
145        <td>Yes</td>
146        <td>A person record with a non-unique employer key.</td>
147    </tr>
148    <tr><td>One-to-many</td>
149        <td><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryMultiKeyCreator</CODE></A></td>
150        <td>No</td>
151        <td>A person record with multiple unique email address keys.</td>
152    </tr>
153    <tr><td>Many-to-many</td>
154        <td><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryMultiKeyCreator</CODE></A></td>
155        <td>Yes</td>
156        <td>A person record with multiple non-unique organization keys.</td>
157    </tr>
158</table>
159</div>
160<p>To configure a database for duplicates. pass true to <A HREF="../../../com/sleepycat/db/DatabaseConfig.html#setSortedDuplicates(boolean)"><CODE>DatabaseConfig.setSortedDuplicates(boolean)</CODE></A>.</p>
161<p>
162Note that <code>SecondaryMultiKeyCreator</code> may also be used for single key
163secondaries (many-to-one and one-to-one); in this case, at most a single key is
164added to the results set.  <code>SecondaryMultiKeyCreator</code> is only
165slightly less efficient than <A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A> in that two or three
166temporary sets must be created to hold the results.
167<P>
168
169<P>
170<DL>
171<DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/SecondaryConfig.html" title="class in com.sleepycat.db"><CODE>SecondaryConfig</CODE></A></DL>
172<HR>
173
174<P>
175
176<!-- ========== METHOD SUMMARY =========== -->
177
178<A NAME="method_summary"><!-- --></A>
179<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
180<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
181<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
182<B>Method Summary</B></FONT></TH>
183</TR>
184<TR BGCOLOR="white" CLASS="TableRowColor">
185<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
186<CODE>&nbsp;void</CODE></FONT></TD>
187<TD><CODE><B><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html#createSecondaryKeys(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, java.util.Set)">createSecondaryKeys</A></B>(<A HREF="../../../com/sleepycat/db/SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</A>&nbsp;secondary,
188                    <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;key,
189                    <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;data,
190                    <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A>&nbsp;results)</CODE>
191
192<BR>
193&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a secondary key entry, given a primary key and data entry.</TD>
194</TR>
195</TABLE>
196&nbsp;
197<P>
198
199<!-- ============ METHOD DETAIL ========== -->
200
201<A NAME="method_detail"><!-- --></A>
202<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
203<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
204<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
205<B>Method Detail</B></FONT></TH>
206</TR>
207</TABLE>
208
209<A NAME="createSecondaryKeys(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, java.util.Set)"><!-- --></A><H3>
210createSecondaryKeys</H3>
211<PRE>
212void <B>createSecondaryKeys</B>(<A HREF="../../../com/sleepycat/db/SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</A>&nbsp;secondary,
213                         <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;key,
214                         <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;data,
215                         <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A>&nbsp;results)
216                         throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE>
217<DL>
218<DD>Creates a secondary key entry, given a primary key and data entry.
219    <p>
220    A secondary key may be derived from the primary key, primary data, or a
221    combination of the primary key and data.  Zero or more secondary keys may
222    be derived from the primary record and returned in the results parameter.
223    To ensure the integrity of a secondary database the key creator method must
224    always return the same results for a given set of input parameters.
225    <p>
226<P>
227<DD><DL>
228<DT><B>Parameters:</B><DD><CODE>secondary</CODE> - the database to which the secondary key will be added.
229    This parameter is passed for informational purposes but is not commonly
230    used.
231    <p><DD><CODE>key</CODE> - the primary key entry.  This parameter must not be modified
232    by this method.
233    <p><DD><CODE>data</CODE> - the primary data entry.  This parameter must not be modified
234    by this method.
235    <p><DD><CODE>results</CODE> - the set to contain the the secondary key DatabaseEntry
236    objects created by this method.
237    <p>
238<DT><B>Throws:</B>
239<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if an error occurs attempting to create the
240    secondary key.</DL>
241</DD>
242</DL>
243<!-- ========= END OF CLASS DATA ========= -->
244<HR>
245
246
247<!-- ======= START OF BOTTOM NAVBAR ====== -->
248<A NAME="navbar_bottom"><!-- --></A>
249<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
250<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
251<TR>
252<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
253<A NAME="navbar_bottom_firstrow"><!-- --></A>
254<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
255  <TR ALIGN="center" VALIGN="top">
256  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
257  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
258  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
259  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/SecondaryMultiKeyCreator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
260  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
261  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
262  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
263  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
264  </TR>
265</TABLE>
266</TD>
267<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
268<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
269</TD>
270</TR>
271
272<TR>
273<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
274&nbsp;<A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A>&nbsp;
275&nbsp;<A HREF="../../../com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD>
276<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
277  <A HREF="../../../index.html?com/sleepycat/db/SecondaryMultiKeyCreator.html" target="_top"><B>FRAMES</B></A>  &nbsp;
278&nbsp;<A HREF="SecondaryMultiKeyCreator.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
279&nbsp;<SCRIPT type="text/javascript">
280  <!--
281  if(window==top) {
282    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
283  }
284  //-->
285</SCRIPT>
286<NOSCRIPT>
287  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
288</NOSCRIPT>
289
290
291</FONT></TD>
292</TR>
293<TR>
294<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
295  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
296<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
297DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
298</TR>
299</TABLE>
300<A NAME="skip-navbar_bottom"></A>
301<!-- ======== END OF BOTTOM NAVBAR ======= -->
302
303<HR>
304<font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
305</BODY>
306</HTML>
307