📄 cachedrowset.html
字号:
<A NAME="getShowDeleted()"><!-- --></A><H3>getShowDeleted</H3><PRE>public boolean <B>getShowDeleted</B>() throws java.sql.SQLException</PRE><DL><DD>This property determines whether or not rows marked for deletion appear in the set of current rows. The default value is false. Note: Allowing deleted rows to remain visible complicates the behavior of some of the methods. However, most users of CachedRowSets can simply ignore this extra detail, since only sophisticated applications will likely want to take advantage of this feature.<DD><DL><DT><B>Returns:</B><DD>true if deleted rows are visible, false otherwise<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="setShowDeleted(boolean)"><!-- --></A><H3>setShowDeleted</H3><PRE>public void <B>setShowDeleted</B>(boolean value) throws java.sql.SQLException</PRE><DL><DD>Set the show deleted property.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - true if deleted rows should be shown, false otherwise<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="populate(java.sql.ResultSet)"><!-- --></A><H3>populate</H3><PRE>public void <B>populate</B>(java.sql.ResultSet data) throws java.sql.SQLException</PRE><DL><DD>Populate the CachedRowSet object with data from a ResultSet. This method is an alternative to execute() for filling the rowset with data. Populate() doesn't require that the properties needed by execute(), such as the command property, be set. A RowSetChangedEvent is sent to all registered listeners prior to returning.<DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - the data to be read<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="execute(java.sql.Connection)"><!-- --></A><H3>execute</H3><PRE>public void <B>execute</B>(java.sql.Connection connection)</PRE><DL><DD>Populates the rowset with data. The first form uses the properties: url/data source name, user, and password to create a database connection. If these properties haven't been set, an exception is thrown. The second form uses an existing JDBC connection object instead. The values of the url/data source name, user, and password properties are ignored when the second form is used. Execute() closes any database connections that it creates. The command specified by the command property is executed to retrieve the data. The current contents of the rowset are discarded and the rowset's metadata is also (re)set. If there are outstanding updates, they are also ignored.<DD><DL></DL></DD></DL><HR><A NAME="acceptChanges()"><!-- --></A><H3>acceptChanges</H3><PRE>public void <B>acceptChanges</B>() throws java.sql.SQLException</PRE><DL><DD>Propagate all row update, insert, and delete changes to a data source. An SQLException is thrown if any of the updates cannot be propagated. If acceptUpdates() fails then the caller can assume that none of the updates are reflected in the data source. The current row is set to the first "updated" row that resulted in an exception, in the case that an exception is thrown. With one exception, if the row that caused the exception is a "deleted" row, then in the usual case, when deleted rows are not shown, the current row isn't affected. When successful, calling acceptUpdates() replaces the original value of the rowset with the current value. Note: Both the original and current value of the rowset are maintained. The original state is the value of the rowset following its creation (i.e. empty), or following the last call to acceptChanges(), execute(), populate(), release(), or restoreOriginal(). If no writer is set, i.e. updates aren't being propagated to an underlying datasource, acceptUpdates() just updates the original value. Internally, a RowSetWriter component is envoked to write the data for each row.<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="acceptChanges(java.sql.Connection)"><!-- --></A><H3>acceptChanges</H3><PRE>public void <B>acceptChanges</B>(java.sql.Connection con) throws java.sql.SQLException</PRE><DL><DD>Like acceptChanges() above, but takes a Connection argument. The Connection is used internally when doing the updates. This form isn't used unless the underlying data source is a JDBC data source.<DD><DL><DT><B>Parameters:</B><DD><CODE>con</CODE> - a database connection<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="restoreOriginal()"><!-- --></A><H3>restoreOriginal</H3><PRE>public void <B>restoreOriginal</B>() throws java.sql.SQLException</PRE><DL><DD>Restores the rowset to its original state, i.e. the original value of the rowset becomes the current value. All updates, inserts, and deletes made to the original state are lost. The cursor is positioned before the first row. A RowSetChangedEvent is sent to all registered listeners prior to returning.<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="release()"><!-- --></A><H3>release</H3><PRE>public void <B>release</B>() throws java.sql.SQLException</PRE><DL><DD>Releases the current contents of the rowset. Outstanding updates are discarded. The rowset contains no rows after release is called. A RowSetChangedEvent is sent to all registered listeners prior to returning.<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="cancelRowDelete()"><!-- --></A><H3>cancelRowDelete</H3><PRE>public void <B>cancelRowDelete</B>() throws java.sql.SQLException</PRE><DL><DD>Cancels deletion of the current row. After calling cancelRowDelete() the current row is no longer marked for deletion. An exception is thrown if there is no current row. Note: This method can be ignored if deleted rows aren't being shown (the normal case).<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="cancelRowInsert()"><!-- --></A><H3>cancelRowInsert</H3><PRE>public void <B>cancelRowInsert</B>() throws java.sql.SQLException</PRE><DL><DD>Cancels insertion of the current row. An exception is thrown if the row isn't an inserted row. The current row is immediately removed from the rowset. This operation cannot be undone.<DD><DL><DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="createShared()"><!-- --></A><H3>createShared</H3><PRE>public <A HREF="../../javax/sql/RowSet.html">RowSet</A> <B>createShared</B>() throws java.sql.SQLException</PRE><DL><DD>Returns a new rowset object backed by the same data. Updates made by a shared duplicate are visible to the original rowset and other duplicates. A rowset and its duplicates form a set of cursors that iterate over a shared set of rows, providing different views of the underlying data. Duplicates also share property values. So, for example, if a rowset is read-only then all of its duplicates will be read-only.<DD><DL><DT><B>Returns:</B><DD>a shared rowset object<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public java.lang.Object <B>clone</B>()</PRE><DL><DD>Returns an identical rowset object backed by a deep copy of this rowset's data. Updates made on a copy are not visible to the original rowset. A copy of a rowset is completely independent from the original. Making a copy saves the cost of creating an identical rowset from first principles. This can be quite expensive, for example, involving querying a remote database server.<DD><DL><DT><B>Returns:</B><DD>a copy of the rowset<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.<DT><B>Overrides:</B><DD>clone in class java.lang.Object</DL></DD></DL><HR><A NAME="createCopy()"><!-- --></A><H3>createCopy</H3><PRE>public <A HREF="../../javax/sql/RowSet.html">RowSet</A> <B>createCopy</B>() throws java.sql.SQLException</PRE><DL><DD>Same as clone() above().<DD><DL><DT><B>Returns:</B><DD>a copy of the rowset<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="toCollection()"><!-- --></A><H3>toCollection</H3><PRE>public java.util.Collection <B>toCollection</B>() throws java.sql.SQLException</PRE><DL><DD>Convert the rowset to a collection of tables. Each tables represents a row of the original rowset. The tables are keyed by column number. A copy of the rowset's contents is made.<DD><DL><DT><B>Returns:</B><DD>a collection object<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="toCollection(int)"><!-- --></A><H3>toCollection</H3><PRE>public java.util.Collection <B>toCollection</B>(int column) throws java.sql.SQLException</PRE><DL><DD>Return a column of the rowset as a collection. Makes a copy of the column's data.<DD><DL><DT><B>Returns:</B><DD>a collection object<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="getReader()"><!-- --></A><H3>getReader</H3><PRE>public <A HREF="../../javax/sql/RowSetReader.html">RowSetReader</A> <B>getReader</B>() throws java.sql.SQLException</PRE><DL><DD>Get the rowset's reader. A reader is a component of type RowSetReader that is registered with a rowset instance and is called by the rowset when it needs to read a new set of rows.<DD><DL><DT><B>Returns:</B><DD>the rowset's reader<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="setReader(javax.sql.RowSetReader)"><!-- --></A><H3>setReader</H3><PRE>public void <B>setReader</B>(<A HREF="../../javax/sql/RowSetReader.html">RowSetReader</A> reader) throws java.sql.SQLException</PRE><DL><DD>Set the rowset's reader. Setting this property is optional. A default reader is used if none is provided.<DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - a new RowSetReader (what if null?)<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="getWriter()"><!-- --></A><H3>getWriter</H3><PRE>public <A HREF="../../javax/sql/RowSetWriter.html">RowSetWriter</A> <B>getWriter</B>() throws java.sql.SQLException</PRE><DL><DD>Get the rowset's writer. A writer is a component of type RowSetWriter that is registered with a rowset instance and is called by the rowset when it needs to write an individual modified row of data to a data source.<DD><DL><DT><B>Returns:</B><DD>the rowset's writer<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><HR><A NAME="setWriter(javax.sql.RowSetWriter)"><!-- --></A><H3>setWriter</H3><PRE>public void <B>setWriter</B>(<A HREF="../../javax/sql/RowSetWriter.html">RowSetWriter</A> writer) throws java.sql.SQLException</PRE><DL><DD>Set the rowset's writer. Setting this property is optional. A default writer is used if none is provided.<DD><DL><DT><B>Parameters:</B><DD><CODE>writer</CODE> - a new RowSetWriter (what if null?)<DT><B>Throws:</B><DD>java.sql.SQLException - if a database-access error occurs.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1"><A NAME="navbar_bottom_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></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -