1625 lines · 82.4 KB · Java
RawDownload
    * virtue of a key already set either on the <code>RowSet</code> object    * itself or on the underlying SQL data.    * <P>    *    * @return a <code>Collection</code> object that contains the values in    * each row in this <code>CachedRowSet</code> object    * @throws SQLException if an error occurs generating the collection    * @see #toCollection(int)    * @see #toCollection(String)    */    public Collection<?> toCollection() throws SQLException;    /**    * Converts the designated column in this <code>CachedRowSet</code> object    * to a <code>Collection</code> object. Implementations have some latitude in    * how they can represent this <code>Collection</code> object because of the    * abstract nature of the <code>Collection</code> framework.    * Each column value should be fully represented in either a    * general purpose <code>Collection</code> implementation or a specialized    * <code>Collection</code> implementation, such as a <code>Vector</code> object.    * An SQL <code>NULL</code> column value must be represented as a <code>null</code>    * in the Java programming language.    * <P>    * The standard reference implementation uses a <code>Vector</code> object    * to contain the column values, and it is expected    * that most implementations will do the same. If a <code>Vector</code> object    * is used, it size must be exactly equal to the number of rows    * in this <code>CachedRowSet</code> object.    *    * @param column an <code>int</code> indicating the column whose values    *        are to be represented in a <code>Collection</code> object    * @return a <code>Collection</code> object that contains the values    * stored in the specified column of this <code>CachedRowSet</code>    * object    * @throws SQLException if an error occurs generating the collection or    * an invalid column id is provided    * @see #toCollection    * @see #toCollection(String)    */    public Collection<?> toCollection(int column) throws SQLException;    /**    * Converts the designated column in this <code>CachedRowSet</code> object    * to a <code>Collection</code> object. Implementations have some latitude in    * how they can represent this <code>Collection</code> object because of the    * abstract nature of the <code>Collection</code> framework.    * Each column value should be fully represented in either a    * general purpose <code>Collection</code> implementation or a specialized    * <code>Collection</code> implementation, such as a <code>Vector</code> object.    * An SQL <code>NULL</code> column value must be represented as a <code>null</code>    * in the Java programming language.    * <P>    * The standard reference implementation uses a <code>Vector</code> object    * to contain the column values, and it is expected    * that most implementations will do the same. If a <code>Vector</code> object    * is used, it size must be exactly equal to the number of rows    * in this <code>CachedRowSet</code> object.    *    * @param column a <code>String</code> object giving the name of the    *        column whose values are to be represented in a collection    * @return a <code>Collection</code> object that contains the values    * stored in the specified column of this <code>CachedRowSet</code>    * object    * @throws SQLException if an error occurs generating the collection or    * an invalid column id is provided    * @see #toCollection    * @see #toCollection(int)    */    public Collection<?> toCollection(String column) throws SQLException;    /**    * Retrieves the <code>SyncProvider</code> implementation for this    * <code>CachedRowSet</code> object. Internally, this method is used by a rowset    * to trigger read or write actions between the rowset    * and the data source. For example, a rowset may need to get a handle    * on the the rowset reader (<code>RowSetReader</code> object) from the    * <code>SyncProvider</code> to allow the rowset to be populated.    * <pre>    *     RowSetReader rowsetReader = null;    *     SyncProvider provider =    *         SyncFactory.getInstance("javax.sql.rowset.provider.RIOptimisticProvider");    *         if (provider instanceof RIOptimisticProvider) {    *             rowsetReader = provider.getRowSetReader();    *         }    * </pre>    * Assuming <i>rowsetReader</i> is a private, accessible field within    * the rowset implementation, when an application calls the <code>execute</code>    * method, it in turn calls on the reader's <code>readData</code> method    * to populate the <code>RowSet</code> object.    *<pre>    *     rowsetReader.readData((RowSetInternal)this);    * </pre>    * <P>    * In addition, an application can use the <code>SyncProvider</code> object    * returned by this method to call methods that return information about the    * <code>SyncProvider</code> object, including information about the    * vendor, version, provider identification, synchronization grade, and locks    * it currently has set.    *    * @return the <code>SyncProvider</code> object that was set when the rowset    *      was instantiated, or if none was was set, the default provider    * @throws SQLException if an error occurs while returning the    * <code>SyncProvider</code> object    * @see #setSyncProvider    */    public SyncProvider getSyncProvider() throws SQLException;    /**    * Sets the <code>SyncProvider</code> objec for this <code>CachedRowSet</code>    * object to the one specified.  This method    * allows the <code>SyncProvider</code> object to be reset.    * <P>    * A <code>CachedRowSet</code> implementation should always be instantiated    * with an available <code>SyncProvider</code> mechanism, but there are    * cases where resetting the <code>SyncProvider</code> object is desirable    * or necessary. For example, an application might want to use the default    * <code>SyncProvider</code> object for a time and then choose to use a provider    * that has more recently become available and better fits its needs.    * <P>    * Resetting the <code>SyncProvider</code> object causes the    * <code>RowSet</code> object to request a new <code>SyncProvider</code> implementation    * from the <code>SyncFactory</code>. This has the effect of resetting    * all previous connections and relationships with the originating    * data source and can potentially drastically change the synchronization    * behavior of a disconnected rowset.    *    * @param provider a <code>String</code> object giving the fully qualified class    *        name of a <code>SyncProvider</code> implementation    * @throws SQLException if an error occurs while attempting to reset the    * <code>SyncProvider</code> implementation    * @see #getSyncProvider    */    public void setSyncProvider(String provider) throws SQLException;    /**    * Returns the number of rows in this <code>CachedRowSet</code>    * object.    *    * @return number of rows in the rowset    */    public int size();    /**    * Sets the metadata for this <code>CachedRowSet</code> object with    * the given <code>RowSetMetaData</code> object. When a    * <code>RowSetReader</code> object is reading the contents of a rowset,    * it creates a <code>RowSetMetaData</code> object and initializes    * it using the methods in the <code>RowSetMetaData</code> implementation.    * The reference implementation uses the <code>RowSetMetaDataImpl</code>    * class. When the reader has completed reading the rowset contents,    * this method is called internally to pass the <code>RowSetMetaData</code>    * object to the rowset.    *    * @param md a <code>RowSetMetaData</code> object containing    * metadata about the columns in this <code>CachedRowSet</code> object    * @throws SQLException if invalid metadata is supplied to the    * rowset    */    public void setMetaData(RowSetMetaData md) throws SQLException;    /**    * Returns a <code>ResultSet</code> object containing the original value of this    * <code>CachedRowSet</code> object.    * <P>    * The cursor for the <code>ResultSet</code>    * object should be positioned before the first row.    * In addition, the returned <code>ResultSet</code> object should have the following    * properties:    * <UL>    * <LI>ResultSet.TYPE_SCROLL_INSENSITIVE    * <LI>ResultSet.CONCUR_UPDATABLE    * </UL>    * <P>    * The original value for a <code>RowSet</code> object is the value it had before    * the last synchronization with the underlying data source.  If there have been    * no synchronizations, the original value will be the value with which the    * <code>RowSet</code> object was populated.  This method is called internally    * when an aplication calls the method <code>acceptChanges</code> and the    * <code>SyncProvider</code> object has been implemented to check for conflicts.    * If this is the case, the writer compares the original value with the value    * currently in the data source to check for conflicts.    *    * @return a <code>ResultSet</code> object that contains the original value for    *         this <code>CachedRowSet</code> object    * @throws SQLException if an error occurs producing the    * <code>ResultSet</code> object    */   public ResultSet getOriginal() throws SQLException;    /**    * Returns a <code>ResultSet</code> object containing the original value for the    * current row only of this <code>CachedRowSet</code> object.    * <P>    * The cursor for the <code>ResultSet</code>    * object should be positioned before the first row.    * In addition, the returned <code>ResultSet</code> object should have the following    * properties:    * <UL>    * <LI>ResultSet.TYPE_SCROLL_INSENSITIVE    * <LI>ResultSet.CONCUR_UPDATABLE    * </UL>    *    * @return the original result set of the row    * @throws SQLException if there is no current row    * @see #setOriginalRow    */    public ResultSet getOriginalRow() throws SQLException;    /**    * Sets the current row in this <code>CachedRowSet</code> object as the original    * row.    * <P>    * This method is called internally after the any modified values in the current    * row have been synchronized with the data source. The current row must be tagged    * as no longer inserted, deleted or updated.    * <P>    * A call to <code>setOriginalRow</code> is irreversible.    *    * @throws SQLException if there is no current row or an error is    * encountered resetting the contents of the original row    * @see #getOriginalRow    */    public void setOriginalRow() throws SQLException;    /**    * Returns an identifier for the object (table) that was used to    * create this <code>CachedRowSet</code> object. This name may be set on multiple occasions,    * and the specification imposes no limits on how many times this    * may occur or whether standard implementations should keep track    * of previous table names.    *    * @return a <code>String</code> object giving the name of the table that is the    *         source of data for this <code>CachedRowSet</code> object or <code>null</code>    *         if no name has been set for the table    * @throws SQLException if an error is encountered returning the table name    * @see javax.sql.RowSetMetaData#getTableName    */    public String getTableName() throws SQLException;    /**    * Sets the identifier for the table from which this <code>CachedRowSet</code>    * object was derived to the given table name. The writer uses this name to    * determine which table to use when comparing the values in the data source with the    * <code>CachedRowSet</code> object's values during a synchronization attempt.    * The table identifier also indicates where modified values from this    * <code>CachedRowSet</code> object should be written.    * <P>    * The implementation of this <code>CachedRowSet</code> object may obtain the    * the name internally from the <code>RowSetMetaDataImpl</code> object.    *    * @param tabName a <code>String</code> object identifying the table from which this             <code>CachedRowSet</code> object was derived; cannot be <code>null</code>    *         but may be an empty string    * @throws SQLException if an error is encountered naming the table or    *     <i>tabName</i> is <code>null</code>    * @see javax.sql.RowSetMetaData#setTableName    * @see javax.sql.RowSetWriter    * @see javax.sql.rowset.spi.SyncProvider    */   public void setTableName(String tabName) throws SQLException;    /**    * Returns an array containing one or more column numbers indicating the columns    * that form a key that uniquely    * identifies a row in this <code>CachedRowSet</code> object.    *    * @return an array containing the column number or numbers that indicate which columns    *       constitute a primary key    *       for a row in this <code>CachedRowSet</code> object. This array should be    *       empty if no columns are representative of a primary key.    * @throws SQLException if this <code>CachedRowSet</code> object is empty    * @see #setKeyColumns    * @see Joinable#getMatchColumnIndexes    * @see Joinable#getMatchColumnNames    */    public int[] getKeyColumns() throws SQLException;    /**    * Sets this <code>CachedRowSet</code> object's <code>keyCols</code>    * field with the given array of column numbers, which forms a key    * for uniquely identifying a row in this <code>CachedRowSet</code> object.    * <p>    * If a <code>CachedRowSet</code> object becomes part of a <code>JoinRowSet</code>    * object, the keys defined by this method and the resulting constraints are    * maintained if the columns designated as key columns also become match    * columns.    *    * @param keys an array of <code>int</code> indicating the columns that form    *        a primary key for this <code>CachedRowSet</code> object; every    *        element in the array must be greater than <code>0</code> and    *        less than or equal to the number of columns in this rowset    * @throws SQLException if any of the numbers in the given array    *            are not valid for this rowset    * @see #getKeyColumns    * @see Joinable#setMatchColumn(String)    * @see Joinable#setMatchColumn(int)     */    public void setKeyColumns(int[] keys) throws SQLException;     /**    * Returns a new <code>RowSet</code> object backed by the same data as    * that of this <code>CachedRowSet</code> object. In effect, both    * <code>CachedRowSet</code> objects have a cursor over the same data.    * As a result, any changes made by a duplicate are visible to the original    * and to any other duplicates, just as a change made by the original is visible    * to all of its duplicates. If a duplicate calls a method that changes the    * underlying data, the method it calls notifies all registered listeners    * just as it would when it is called by the original <code>CachedRowSet</code>    * object.    * <P>    * In addition, any <code>RowSet</code> object    * created by this method will have the same properties as this    * <code>CachedRowSet</code> object. For example, if this <code>CachedRowSet</code>    * object is read-only, all of its duplicates will also be read-only. If it is    * changed to be updatable, the duplicates also become updatable.    * <P>    * NOTE: If multiple threads access <code>RowSet</code> objects created from    * the <code>createShared()</code> method, the following behavior is specified    * to preserve shared data integrity: reads and writes of all    * shared <code>RowSet</code> objects should be made serially between each    * object and the single underlying tabular structure.    *    * @return a new shared <code>RowSet</code> object that has the same properties    *         as this <code>CachedRowSet</code> object and that has a cursor over    *         the same data    * @throws SQLException if an error occurs or cloning is not    * supported in the underlying platform    * @see javax.sql.RowSetEvent    * @see javax.sql.RowSetListener    */    public RowSet createShared() throws SQLException;    /**    * Creates a <code>RowSet</code> object that is a deep copy of the data in    * this <code>CachedRowSet</code> object. In contrast to    * the <code>RowSet</code> object generated from a <code>createShared</code>    * call, updates made to the copy of the original <code>RowSet</code> object    * must not be visible to the original <code>RowSet</code> object. Also, any    * event listeners that are registered with the original    * <code>RowSet</code> must not have scope over the new    * <code>RowSet</code> copies. In addition, any constraint restrictions    * established must be maintained.    *    * @return a new <code>RowSet</code> object that is a deep copy    * of this <code>CachedRowSet</code> object and is    * completely independent of this <code>CachedRowSet</code> object    * @throws SQLException if an error occurs in generating the copy of    * the of this <code>CachedRowSet</code> object    * @see #createShared    * @see #createCopySchema    * @see #createCopyNoConstraints    * @see javax.sql.RowSetEvent    * @see javax.sql.RowSetListener    */    public CachedRowSet createCopy() throws SQLException;     /**     * Creates a <code>CachedRowSet</code> object that is an empty copy of this     * <code>CachedRowSet</code> object.  The copy     * must not contain any contents but only represent the table     * structure of the original <code>CachedRowSet</code> object. In addition, primary     * or foreign key constraints set in the originating <code>CachedRowSet</code> object must     * be equally enforced in the new empty <code>CachedRowSet</code> object.     * In contrast to     * the <code>RowSet</code> object generated from a <code>createShared</code> method     * call, updates made to a copy of this <code>CachedRowSet</code> object with the     * <code>createCopySchema</code> method must not be visible to it.     * <P>     * Applications can form a <code>WebRowSet</code> object from the <code>CachedRowSet</code>     * object returned by this method in order     * to export the <code>RowSet</code> schema definition to XML for future use.     *     * @throws SQLException if an error occurs in cloning the structure of this     *         <code>CachedRowSet</code> object     * @see #createShared     * @see #createCopySchema     * @see #createCopyNoConstraints     * @see javax.sql.RowSetEvent     * @see javax.sql.RowSetListener     */    public CachedRowSet createCopySchema() throws SQLException;     /**     * Creates a <code>CachedRowSet</code> object that is a deep copy of     * this <code>CachedRowSet</code> object's data but is independent of it.     * In contrast to     * the <code>RowSet</code> object generated from a <code>createShared</code>     * method call, updates made to a copy of this <code>CachedRowSet</code> object     * must not be visible to it. Also, any     * event listeners that are registered with this     * <code>CachedRowSet</code> object must not have scope over the new     * <code>RowSet</code> object. In addition, any constraint restrictions     * established for this <code>CachedRowSet</code> object must <b>not</b> be maintained     * in the copy.     *     * @return a new <code>CachedRowSet</code> object that is a deep copy     *     of this <code>CachedRowSet</code> object and is     *     completely independent of this  <code>CachedRowSet</code> object     * @throws SQLException if an error occurs in generating the copy of     *     the of this <code>CachedRowSet</code> object     * @see #createCopy     * @see #createShared     * @see #createCopySchema     * @see javax.sql.RowSetEvent     * @see javax.sql.RowSetListener     */    public CachedRowSet createCopyNoConstraints() throws SQLException;     /**     * Retrieves the first warning reported by calls on this <code>RowSet</code> object.     * Subsequent warnings on this <code>RowSet</code> object will be chained to the     * <code>RowSetWarning</code> object that this method returns.     *     * The warning chain is automatically cleared each time a new row is read.     * This method may not be called on a RowSet object that has been closed;     * doing so will cause a <code>SQLException</code> to be thrown.     *     * @return RowSetWarning the first <code>RowSetWarning</code>     * object reported or null if there are none     * @throws SQLException if this method is called on a closed RowSet     * @see RowSetWarning     */    public RowSetWarning getRowSetWarnings() throws SQLException;     /**     * Retrieves a <code>boolean</code> indicating whether rows marked     * for deletion appear in the set of current rows. If <code>true</code> is     * returned, deleted rows are visible with the current rows. If     * <code>false</code> is returned, rows are not visible with the set of     * current rows. The default value is <code>false</code>.     * <P>     * Standard rowset implementations may choose to restrict this behavior     * due to security considerations or to better fit certain deployment     * scenarios. This is left as implementation defined and does not     * represent standard behavior.     * <P>     * Note: Allowing deleted rows to remain visible complicates the behavior     * of some standard JDBC <code>RowSet</code> Implementations methods.     * However, most rowset users can simply ignore this extra detail because     * only very specialized applications will likely want to take advantage of     * this feature.     *     * @return <code>true</code> if deleted rows are visible;     *         <code>false</code> otherwise     * @throws SQLException if a rowset implementation is unable to     * to determine whether rows marked for deletion are visible     * @see #setShowDeleted     */    public boolean getShowDeleted() throws SQLException;     /**     * Sets the property <code>showDeleted</code> to the given     * <code>boolean</code> value, which determines whether     * rows marked for deletion appear in the set of current rows.     * If the value is set to <code>true</code>, deleted rows are immediately     * visible with the set of current rows. If the value is set to     * <code>false</code>, the deleted rows are set as invisible with the     * current set of rows.     * <P>     * Standard rowset implementations may choose to restrict this behavior     * due to security considerations or to better fit certain deployment     * scenarios. This is left as implementations defined and does not     * represent standard behavior.     *     * @param b <code>true</code> if deleted rows should be shown;     *              <code>false</code> otherwise     * @exception SQLException if a rowset implementation is unable to     * to reset whether deleted rows should be visible     * @see #getShowDeleted     */    public void setShowDeleted(boolean b) throws SQLException;     /**     * Each <code>CachedRowSet</code> object's <code>SyncProvider</code> contains     * a <code>Connection</code> object from the <code>ResultSet</code> or JDBC     * properties passed to it's constructors. This method wraps the     * <code>Connection</code> commit method to allow flexible     * auto commit or non auto commit transactional control support.     * <p>     * Makes all changes that are performed by the <code>acceptChanges()</code>     * method since the previous commit/rollback permanent. This method should     * be used only when auto-commit mode has been disabled.     *     * @throws SQLException if a database access error occurs or this     * Connection object within this <code>CachedRowSet</code> is in auto-commit mode     * @see java.sql.Connection#setAutoCommit     */    public void commit() throws SQLException;     /**     * Each <code>CachedRowSet</code> object's <code>SyncProvider</code> contains     * a <code>Connection</code> object from the original <code>ResultSet</code>     * or JDBC properties passed to it.     * <p>     * Undoes all changes made in the current transaction.  This method     * should be used only when auto-commit mode has been disabled.     *     * @throws SQLException if a database access error occurs or this Connection

Lines 1001–1500 of 1625. Previous lines