📄 cachedrowset.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Tue Oct 06 18:12:04 PDT 1998 --><TITLE>: Class CachedRowSet</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../javax/sql/ConnectionEvent.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="CachedRowSet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.sql</FONT><BR>Class CachedRowSet</H2><PRE>java.lang.Object | +--<B>javax.sql.CachedRowSet</B></PRE><HR><DL><DT>public class <B>CachedRowSet</B><DT>extends java.lang.Object<DT>implements <A HREF="../../javax/sql/RowSet.html">RowSet</A>, java.io.Serializable, java.lang.Cloneable</DL><P><P>A CachedRowSet is a disconnected, serializable, scrollable container for tabular data. A primary purpose of the CachedRowSet class is to provide a representation of a JDBC ResultSet that can be passed between different components of a remote application. For example, a CachedResultSet can be used to send the result of a query executed by an Enterprise JavaBeans component running in a server environment over a network to a client running in a web browser. A second use for CachedRowSets is to provide scrolling and updating for ResultSets that don't provide these capabilities themselves. A CachedRowSet can be used to augment the capabilities of a JDBC driver that doesn't have full support for scrolling and updating. Finally, a CachedRowSet can be used to provide Java applications with access to tabular data in an environment such as a thin client or PDA, where it would be inappropriate to use a JDBC driver due to resource limitations or security considerations. The CachedRowSet class provides a means to "get rows in" and "get changed rows out" without the need to implement the full JDBC API. <P>A CachedRowSet object can contain data retrieved via a JDBC driver or data from some other source, such as a spreadsheet. Both a CachedRowSet object and its metadata can be created from scratch. A component that acts as a factory for rowsets can use this capability to create a rowset containing data from non-JDBC data sources. We expect that rowset objects will contain data that was fetched from an SQL database using JDBC most of the time. <P>The term 'disconnected' implies that a CachedRowSet only makes use of a JDBC connection briefly while data is being read from the database and used to populate it with rows, and again while updated rows are being propagated back to the underlying database. During the remainder of its lifetime, a CachedRowSet object isn't associated with an underlying database connection. A CachedRowSet object can simply be thought of as a disconnected set of rows that are being cached outside of a data source. Since all data is cached in memory, CachedRowSets are not appropriate for extremely large data sets. <P>The contents of a CachedRowSet may be updated and the updates can be propagated to an underlying data source. CachedRowSets support an optimistic concurrency control mechanism---no locks are maintained in the underlying database during disconnected use of the rowset. The CachedRowSet class provides an extensible reader/writer facility that allows for customization of data retrieval and updating. Both the original value and current value of the CachedRowSet are maintained for use by the optimistic CC routines.<P><DL><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#javax.sql.CachedRowSet">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" ID="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#CachedRowSet()">CachedRowSet</A></B>()</CODE><BR> Create a CachedRowSet object.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" ID="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#acceptChanges()">acceptChanges</A></B>()</CODE><BR> Propagate all row update, insert, and delete changes to a data source.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#acceptChanges(java.sql.Connection)">acceptChanges</A></B>(java.sql.Connection con)</CODE><BR> Like acceptChanges() above, but takes a Connection argument.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#cancelRowDelete()">cancelRowDelete</A></B>()</CODE><BR> Cancels deletion of the current row.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#cancelRowInsert()">cancelRowInsert</A></B>()</CODE><BR> Cancels insertion of the current row.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.Object</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#clone()">clone</A></B>()</CODE><BR> Returns an identical rowset object backed by a deep copy of this rowset's data.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/sql/RowSet.html">RowSet</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#createCopy()">createCopy</A></B>()</CODE><BR> Same as clone() above().</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/sql/RowSet.html">RowSet</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#createShared()">createShared</A></B>()</CODE><BR> Returns a new rowset object backed by the same data.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#execute(java.sql.Connection)">execute</A></B>(java.sql.Connection connection)</CODE><BR> Populates the rowset with data.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/sql/RowSetReader.html">RowSetReader</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#getReader()">getReader</A></B>()</CODE><BR> Get the rowset's reader.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#getShowDeleted()">getShowDeleted</A></B>()</CODE><BR> This property determines whether or not rows marked for deletion appear in the set of current rows.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/sql/RowSetWriter.html">RowSetWriter</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#getWriter()">getWriter</A></B>()</CODE><BR> Get the rowset's writer.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#populate(java.sql.ResultSet)">populate</A></B>(java.sql.ResultSet data)</CODE><BR> Populate the CachedRowSet object with data from a ResultSet.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#release()">release</A></B>()</CODE><BR> Releases the current contents of the rowset.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#restoreOriginal()">restoreOriginal</A></B>()</CODE><BR> Restores the rowset to its original state, i.e.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#setReader(javax.sql.RowSetReader)">setReader</A></B>(<A HREF="../../javax/sql/RowSetReader.html">RowSetReader</A> reader)</CODE><BR> Set the rowset's reader.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#setShowDeleted(boolean)">setShowDeleted</A></B>(boolean value)</CODE><BR> Set the show deleted property.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#setWriter(javax.sql.RowSetWriter)">setWriter</A></B>(<A HREF="../../javax/sql/RowSetWriter.html">RowSetWriter</A> writer)</CODE><BR> Set the rowset's writer.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Collection</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#toCollection()">toCollection</A></B>()</CODE><BR> Convert the rowset to a collection of tables.</TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Collection</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/sql/CachedRowSet.html#toCollection(int)">toCollection</A></B>(int column)</CODE><BR> Return a column of the rowset as a collection.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" ID="TableRowColor"><TD><CODE>equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" ID="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="CachedRowSet()"><!-- --></A><H3>CachedRowSet</H3><PRE>public <B>CachedRowSet</B>() throws java.sql.SQLException</PRE><DL><DD>Create a CachedRowSet object. The object has no metadata.<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" ID="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -