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.6.0_03) on Mon Apr 12 16:25:48 EDT 2010 --> 6<TITLE> 7Sequence (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="date" CONTENT="2010-04-12"> 11 12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style"> 13 14<SCRIPT type="text/javascript"> 15function windowTitle() 16{ 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="Sequence (Oracle - Berkeley DB Java API)"; 19 } 20} 21</SCRIPT> 22<NOSCRIPT> 23</NOSCRIPT> 24 25</HEAD> 26 27<BODY BGCOLOR="white" onload="windowTitle();"> 28<HR> 29 30 31<!-- ========= START OF TOP NAVBAR ======= --> 32<A NAME="navbar_top"><!-- --></A> 33<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 35<TR> 36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 37<A NAME="navbar_top_firstrow"><!-- --></A> 38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 39 <TR ALIGN="center" VALIGN="top"> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Sequence.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49</TABLE> 50</TD> 51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 52<b>Berkeley DB</b><br><font size="-1"> version 4.8.30</font></EM> 53</TD> 54</TR> 55 56<TR> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A> 59 <A HREF="../../../com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../index.html?com/sleepycat/db/Sequence.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="Sequence.html" target="_top"><B>NO FRAMES</B></A> 63 <SCRIPT type="text/javascript"> 64 <!-- 65 if(window==top) { 66 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); 67 } 68 //--> 69</SCRIPT> 70<NOSCRIPT> 71 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> 72</NOSCRIPT> 73 74 75</FONT></TD> 76</TR> 77<TR> 78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 79 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 82</TR> 83</TABLE> 84<A NAME="skip-navbar_top"></A> 85<!-- ========= END OF TOP NAVBAR ========= --> 86 87<HR> 88<!-- ======== START OF CLASS DATA ======== --> 89<H2> 90<FONT SIZE="-1"> 91com.sleepycat.db</FONT> 92<BR> 93Class Sequence</H2> 94<PRE> 95<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> 96 <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.db.Sequence</B> 97</PRE> 98<HR> 99<DL> 100<DT><PRE>public class <B>Sequence</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> 101</PRE> 102 103<P> 104A Sequence handle is used to manipulate a sequence record in a database. 105Sequence handles are opened using the <A HREF="../../../com/sleepycat/db/Database.html#openSequence(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.SequenceConfig)"><CODE>Database.openSequence</CODE></A> method. 106<P> 107 108<P> 109<HR> 110 111<P> 112 113<!-- ========== METHOD SUMMARY =========== --> 114 115<A NAME="method_summary"><!-- --></A> 116<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 117<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 118<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 119<B>Method Summary</B></FONT></TH> 120</TR> 121<TR BGCOLOR="white" CLASS="TableRowColor"> 122<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 123<CODE> void</CODE></FONT></TD> 124<TD><CODE><B><A HREF="../../../com/sleepycat/db/Sequence.html#close()">close</A></B>()</CODE> 125 126<BR> 127 Close a sequence.</TD> 128</TR> 129<TR BGCOLOR="white" CLASS="TableRowColor"> 130<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 131<CODE> long</CODE></FONT></TD> 132<TD><CODE><B><A HREF="../../../com/sleepycat/db/Sequence.html#get(com.sleepycat.db.Transaction, int)">get</A></B>(<A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 133 int delta)</CODE> 134 135<BR> 136 Return the next available element in the sequence and changes the sequence 137 value by <code>delta</code>.</TD> 138</TR> 139<TR BGCOLOR="white" CLASS="TableRowColor"> 140<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 141<CODE> <A HREF="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A></CODE></FONT></TD> 142<TD><CODE><B><A HREF="../../../com/sleepycat/db/Sequence.html#getDatabase()">getDatabase</A></B>()</CODE> 143 144<BR> 145 Return the Database handle associated with this sequence.</TD> 146</TR> 147<TR BGCOLOR="white" CLASS="TableRowColor"> 148<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 149<CODE> <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A></CODE></FONT></TD> 150<TD><CODE><B><A HREF="../../../com/sleepycat/db/Sequence.html#getKey()">getKey</A></B>()</CODE> 151 152<BR> 153 Return the DatabaseEntry used to open this sequence.</TD> 154</TR> 155<TR BGCOLOR="white" CLASS="TableRowColor"> 156<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 157<CODE> <A HREF="../../../com/sleepycat/db/SequenceStats.html" title="class in com.sleepycat.db">SequenceStats</A></CODE></FONT></TD> 158<TD><CODE><B><A HREF="../../../com/sleepycat/db/Sequence.html#getStats(com.sleepycat.db.StatsConfig)">getStats</A></B>(<A HREF="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db">StatsConfig</A> config)</CODE> 159 160<BR> 161 Return statistical information about the sequence.</TD> 162</TR> 163</TABLE> 164 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 165<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 166<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 167<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> 168</TR> 169<TR BGCOLOR="white" CLASS="TableRowColor"> 170<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 171</TR> 172</TABLE> 173 174<P> 175 176<!-- ============ METHOD DETAIL ========== --> 177 178<A NAME="method_detail"><!-- --></A> 179<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 180<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 181<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 182<B>Method Detail</B></FONT></TH> 183</TR> 184</TABLE> 185 186<A NAME="close()"><!-- --></A><H3> 187close</H3> 188<PRE> 189public void <B>close</B>() 190 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 191<DL> 192<DD>Close a sequence. Any unused cached values are lost. 193 <p> 194 The sequence handle may not be used again after this method has been 195 called, regardless of the method's success or failure. 196 <p> 197 <p> 198<P> 199<DD><DL> 200 201<DT><B>Throws:</B> 202<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 203</DD> 204</DL> 205<HR> 206 207<A NAME="get(com.sleepycat.db.Transaction, int)"><!-- --></A><H3> 208get</H3> 209<PRE> 210public long <B>get</B>(<A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 211 int delta) 212 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 213<DL> 214<DD>Return the next available element in the sequence and changes the sequence 215 value by <code>delta</code>. The value of <code>delta</code> must be 216 greater than zero. If there are enough cached values in the sequence 217 handle then they will be returned. Otherwise the next value will be 218 fetched from the database and incremented (decremented) by enough to cover 219 the <code>delta</code> and the next batch of cached values. 220 <p> 221 The <code>txn</code> handle must be null if the sequence handle was opened 222 with a non-zero cache size. 223 <p> 224 For maximum concurrency, a non-zero cache size should be specified prior to 225 opening the sequence handle, the <code>txn</code> handle should be 226 <code>null</code>, and <A HREF="../../../com/sleepycat/db/SequenceConfig.html#setAutoCommitNoSync(boolean)"><CODE>SequenceConfig.setAutoCommitNoSync</CODE></A> should 227 be called to disable log flushes. 228 <p> 229<P> 230<DD><DL> 231<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 232may be specified to use auto-commit. For a non-transactional database, null 233must be specified. 234 <p><DD><CODE>delta</CODE> - the amount by which to increment or decrement the sequence 235 <p> 236<DT><B>Returns:</B><DD>the next available element in the sequence 237<DT><B>Throws:</B> 238<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 239</DD> 240</DL> 241<HR> 242 243<A NAME="getDatabase()"><!-- --></A><H3> 244getDatabase</H3> 245<PRE> 246public <A HREF="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db">Database</A> <B>getDatabase</B>() 247 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 248<DL> 249<DD>Return the Database handle associated with this sequence. 250 <p> 251<P> 252<DD><DL> 253 254<DT><B>Returns:</B><DD>The Database handle associated with this sequence. 255<DT><B>Throws:</B> 256<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 257</DD> 258</DL> 259<HR> 260 261<A NAME="getKey()"><!-- --></A><H3> 262getKey</H3> 263<PRE> 264public <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> <B>getKey</B>() 265 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 266<DL> 267<DD>Return the DatabaseEntry used to open this sequence. 268 <p> 269<P> 270<DD><DL> 271 272<DT><B>Returns:</B><DD>The DatabaseEntry used to open this sequence. 273<DT><B>Throws:</B> 274<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 275</DD> 276</DL> 277<HR> 278 279<A NAME="getStats(com.sleepycat.db.StatsConfig)"><!-- --></A><H3> 280getStats</H3> 281<PRE> 282public <A HREF="../../../com/sleepycat/db/SequenceStats.html" title="class in com.sleepycat.db">SequenceStats</A> <B>getStats</B>(<A HREF="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db">StatsConfig</A> config) 283 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 284<DL> 285<DD>Return statistical information about the sequence. 286 <p> 287 In the presence of multiple threads or processes accessing an active 288 sequence, the information returned by this method may be out-of-date. 289 <p> 290 The getStats method cannot be transaction-protected. For this reason, it 291 should be called in a thread of control that has no open cursors or active 292 transactions. 293 <p> 294<P> 295<DD><DL> 296<DT><B>Parameters:</B><DD><CODE>config</CODE> - The statistics returned; if null, default statistics are returned. 297 <p> 298<DT><B>Returns:</B><DD>Sequence statistics. 299<DT><B>Throws:</B> 300<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 301</DD> 302</DL> 303<!-- ========= END OF CLASS DATA ========= --> 304<HR> 305 306 307<!-- ======= START OF BOTTOM NAVBAR ====== --> 308<A NAME="navbar_bottom"><!-- --></A> 309<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 310<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 311<TR> 312<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 313<A NAME="navbar_bottom_firstrow"><!-- --></A> 314<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 315 <TR ALIGN="center" VALIGN="top"> 316 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 317 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 318 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 319 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Sequence.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 320 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 321 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 322 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 323 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 324 </TR> 325</TABLE> 326</TD> 327<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 328<b>Berkeley DB</b><br><font size="-1"> version 4.8.30</font></EM> 329</TD> 330</TR> 331 332<TR> 333<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 334 <A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A> 335 <A HREF="../../../com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 336<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 337 <A HREF="../../../index.html?com/sleepycat/db/Sequence.html" target="_top"><B>FRAMES</B></A> 338 <A HREF="Sequence.html" target="_top"><B>NO FRAMES</B></A> 339 <SCRIPT type="text/javascript"> 340 <!-- 341 if(window==top) { 342 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); 343 } 344 //--> 345</SCRIPT> 346<NOSCRIPT> 347 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> 348</NOSCRIPT> 349 350 351</FONT></TD> 352</TR> 353<TR> 354<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 355 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 356<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 357DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 358</TR> 359</TABLE> 360<A NAME="skip-navbar_bottom"></A> 361<!-- ======== END OF BOTTOM NAVBAR ======= --> 362 363<HR> 364<font size=1>Copyright (c) 1996-2009 Oracle. All rights reserved.</font> 365</BODY> 366</HTML> 367