} this.concurrency = concurrency; } /** * Returns a <code>boolean</code> indicating whether this * <code>RowSet</code> object is read-only. * Any attempts to update a read-only <code>RowSet</code> object will result in an * <code>SQLException</code> being thrown. By default, * rowsets are updatable if updates are possible. * * @return <code>true</code> if this <code>RowSet</code> object * cannot be updated; <code>false</code> otherwise * @see #setConcurrency * @see #setReadOnly */ public boolean isReadOnly() { return readOnly; }; /** * Sets this <code>RowSet</code> object's readOnly property to the given <code>boolean</code>. * * @param value <code>true</code> to indicate that this * <code>RowSet</code> object is read-only; * <code>false</code> to indicate that it is updatable */ public void setReadOnly(boolean value) { readOnly = value; } /** * Returns the transaction isolation property for this * <code>RowSet</code> object's connection. This property represents * the transaction isolation level requested for use in transactions. * <P> * For <code>RowSet</code> implementations such as * the <code>CachedRowSet</code> that operate in a disconnected environment, * the <code>SyncProvider</code> object * offers complementary locking and data integrity options. The * options described below are pertinent only to connected <code>RowSet</code> * objects (<code>JdbcRowSet</code> objects). * * @return one of the following constants: * <code>Connection.TRANSACTION_NONE</code>, * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or * <code>Connection.TRANSACTION_SERIALIZABLE</code> * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncProvider * @see #setTransactionIsolation */ public int getTransactionIsolation() { return isolation; }; /** * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given * constant. The DBMS will use this transaction isolation level for * transactions if it can. * <p> * For <code>RowSet</code> implementations such as * the <code>CachedRowSet</code> that operate in a disconnected environment, * the <code>SyncProvider</code> object being used * offers complementary locking and data integrity options. The * options described below are pertinent only to connected <code>RowSet</code> * objects (<code>JdbcRowSet</code> objects). * * @param level one of the following constants, listed in ascending order: * <code>Connection.TRANSACTION_NONE</code>, * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or * <code>Connection.TRANSACTION_SERIALIZABLE</code> * @throws SQLException if the given parameter is not one of the Connection * constants * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncProvider * @see #getTransactionIsolation */ public void setTransactionIsolation(int level) throws SQLException { if ((level != Connection.TRANSACTION_NONE) && (level != Connection.TRANSACTION_READ_COMMITTED) && (level != Connection.TRANSACTION_READ_UNCOMMITTED) && (level != Connection.TRANSACTION_REPEATABLE_READ) && (level != Connection.TRANSACTION_SERIALIZABLE)) { throw new SQLException("Invalid transaction isolation set. Must " + "be either " + "Connection.TRANSACTION_NONE or " + "Connection.TRANSACTION_READ_UNCOMMITTED or " + "Connection.TRANSACTION_READ_COMMITTED or " + "Connection.RRANSACTION_REPEATABLE_READ or " + "Connection.TRANSACTION_SERIALIZABLE"); } this.isolation = level; } /** * Retrieves the type map associated with the <code>Connection</code> * object for this <code>RowSet</code> object. * <P> * Drivers that support the JDBC 3.0 API will create * <code>Connection</code> objects with an associated type map. * This type map, which is initially empty, can contain one or more * fully-qualified SQL names and <code>Class</code> objects indicating * the class to which the named SQL value will be mapped. The type mapping * specified in the connection's type map is used for custom type mapping * when no other type map supersedes it. * <p> * If a type map is explicitly supplied to a method that can perform * custom mapping, that type map supersedes the connection's type map. * * @return the <code>java.util.Map</code> object that is the type map * for this <code>RowSet</code> object's connection */ public java.util.Map<String,Class<?>> getTypeMap() { return map; } /** * Installs the given <code>java.util.Map</code> object as the type map * associated with the <code>Connection</code> object for this * <code>RowSet</code> object. The custom mapping indicated in * this type map will be used unless a different type map is explicitly * supplied to a method, in which case the type map supplied will be used. * * @param map a <code>java.util.Map</code> object that contains the * mapping from SQL type names for user defined types (UDT) to classes in * the Java programming language. Each entry in the <code>Map</code> * object consists of the fully qualified SQL name of a UDT and the * <code>Class</code> object for the <code>SQLData</code> implementation * of that UDT. May be <code>null</code>. */ public void setTypeMap(java.util.Map<String,Class<?>> map) { this.map = map; } /** * Retrieves the maximum number of bytes that can be used for a column * value in this <code>RowSet</code> object. * This limit applies only to columns that hold values of the * following types: <code>BINARY</code>, <code>VARBINARY</code>, * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess * data is silently discarded. * * @return an <code>int</code> indicating the current maximum column size * limit; zero means that there is no limit * @throws SQLException if an error occurs internally determining the * maximum limit of the column size */ public int getMaxFieldSize() throws SQLException { return maxFieldSize; } /** * Sets the maximum number of bytes that can be used for a column * value in this <code>RowSet</code> object to the given number. * This limit applies only to columns that hold values of the * following types: <code>BINARY</code>, <code>VARBINARY</code>, * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess * data is silently discarded. For maximum portability, it is advisable to * use values greater than 256. * * @param max an <code>int</code> indicating the new maximum column size * limit; zero means that there is no limit * @throws SQLException if (1) an error occurs internally setting the * maximum limit of the column size or (2) a size of less than 0 is set */ public void setMaxFieldSize(int max) throws SQLException { if (max < 0) { throw new SQLException("Invalid max field size set. Cannot be of " + "value: " + max); } maxFieldSize = max; } /** * Retrieves the maximum number of rows that this <code>RowSet</code> object may contain. If * this limit is exceeded, the excess rows are silently dropped. * * @return an <code>int</code> indicating the current maximum number of * rows; zero means that there is no limit * @throws SQLException if an error occurs internally determining the * maximum limit of rows that a <code>Rowset</code> object can contain */ public int getMaxRows() throws SQLException { return maxRows; } /** * Sets the maximum number of rows that this <code>RowSet</code> object may contain to * the given number. If this limit is exceeded, the excess rows are * silently dropped. * * @param max an <code>int</code> indicating the current maximum number * of rows; zero means that there is no limit * @throws SQLException if an error occurs internally setting the * maximum limit on the number of rows that a JDBC <code>RowSet</code> object * can contain; or if <i>max</i> is less than <code>0</code>; or * if <i>max</i> is less than the <code>fetchSize</code> of the * <code>RowSet</code> */ public void setMaxRows(int max) throws SQLException { if (max < 0) { throw new SQLException("Invalid max row size set. Cannot be of " + "value: " + max); } else if (max < this.getFetchSize()) { throw new SQLException("Invalid max row size set. Cannot be less " + "than the fetchSize."); } this.maxRows = max; } /** * Sets to the given <code>boolean</code> whether or not the driver will * scan for escape syntax and do escape substitution before sending SQL * statements to the database. The default is for the driver to do escape * processing. * <P> * Note: Since <code>PreparedStatement</code> objects have usually been * parsed prior to making this call, disabling escape processing for * prepared statements will likely have no effect. * * @param enable <code>true</code> to enable escape processing; * <code>false</code> to disable it * @throws SQLException if an error occurs setting the underlying JDBC * technology-enabled driver to process the escape syntax */ public void setEscapeProcessing(boolean enable) throws SQLException { escapeProcessing = enable; } /** * Retrieves the maximum number of seconds the driver will wait for a * query to execute. If the limit is exceeded, an <code>SQLException</code> * is thrown. * * @return the current query timeout limit in seconds; zero means that * there is no limit * @throws SQLException if an error occurs in determining the query * time-out value */ public int getQueryTimeout() throws SQLException { return queryTimeout; } /** * Sets to the given number the maximum number of seconds the driver will * wait for a query to execute. If the limit is exceeded, an * <code>SQLException</code> is thrown. * * @param seconds the new query time-out limit in seconds; zero means that * there is no limit; must not be less than zero * @throws SQLException if an error occurs setting the query * time-out or if the query time-out value is less than 0 */ public void setQueryTimeout(int seconds) throws SQLException { if (seconds < 0) { throw new SQLException("Invalid query timeout value set. Cannot be " + "of value: " + seconds); } this.queryTimeout = seconds; } /** * Retrieves a <code>boolean</code> indicating whether rows marked * for deletion appear in the set of current rows. * The default value is <code>false</code>. * <P> * Note: Allowing deleted rows to remain visible complicates the behavior * of some of the methods. However, most <code>RowSet</code> object users * can simply ignore this extra detail because only sophisticated * 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 an error occurs determining if deleted rows * are visible or not * @see #setShowDeleted */ public boolean getShowDeleted() throws SQLException { return showDeleted; } /** * 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. * * @param value <code>true</code> if deleted rows should be shown; * <code>false</code> otherwise * @throws SQLException if an error occurs setting whether deleted * rows are visible or not * @see #getShowDeleted */ public void setShowDeleted(boolean value) throws SQLException { showDeleted = value; } /** * Ascertains whether escape processing is enabled for this * <code>RowSet</code> object. * * @return <code>true</code> if escape processing is turned on; * <code>false</code> otherwise * @throws SQLException if an error occurs determining if escape * processing is enabled or not or if the internal escape * processing trigger has not been enabled */ public boolean getEscapeProcessing() throws SQLException { return escapeProcessing; } /** * Gives the driver a performance hint as to the direction in * which the rows in this <code>RowSet</code> object will be * processed. The driver may ignore this hint. * <P> * A <code>RowSet</code> object inherits the default properties of the * <code>ResultSet</code> object from which it got its data. That * <code>ResultSet</code> object's default fetch direction is set by * the <code>Statement</code> object that created it. * <P> * This method applies to a <code>RowSet</code> object only while it is * connected to a database using a JDBC driver. * <p> * A <code>RowSet</code> object may use this method at any time to change * its setting for the fetch direction. * * @param direction one of <code>ResultSet.FETCH_FORWARD</code>, * <code>ResultSet.FETCH_REVERSE</code>, or * <code>ResultSet.FETCH_UNKNOWN</code> * @throws SQLException if (1) the <code>RowSet</code> type is * <code>TYPE_FORWARD_ONLY</code> and the given fetch direction is not * <code>FETCH_FORWARD</code> or (2) the given fetch direction is not * one of the following: * ResultSet.FETCH_FORWARD, * ResultSet.FETCH_REVERSE, or * ResultSet.FETCH_UNKNOWN * @see #getFetchDirection */ public void setFetchDirection(int direction) throws SQLException { // Changed the condition checking to the below as there were two // conditions that had to be checked // 1. RowSet is TYPE_FORWARD_ONLY and direction is not FETCH_FORWARD // 2. Direction is not one of the valid values if (((getType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD)) || ((direction != ResultSet.FETCH_FORWARD) && (direction != ResultSet.FETCH_REVERSE) && (direction != ResultSet.FETCH_UNKNOWN))) { throw new SQLException("Invalid Fetch Direction"); } fetchDir = direction; } /** * Retrieves this <code>RowSet</code> object's current setting for the * fetch direction. The default type is <code>ResultSet.FETCH_FORWARD</code> * * @return one of <code>ResultSet.FETCH_FORWARD</code>, * <code>ResultSet.FETCH_REVERSE</code>, or * <code>ResultSet.FETCH_UNKNOWN</code> * @throws SQLException if an error occurs in determining the * current fetch direction for fetching rows * @see #setFetchDirection */ public int getFetchDirection() throws SQLException { //Added the following code to throw a //SQL Exception if the fetchDir is not //set properly.Bug id:4914155 // This checking is not necessary! /* if((fetchDir != ResultSet.FETCH_FORWARD) && (fetchDir != ResultSet.FETCH_REVERSE) && (fetchDir != ResultSet.FETCH_UNKNOWN)) { throw new SQLException("Fetch Direction Invalid"); } */ return (fetchDir); } /** * Sets the fetch size for this <code>RowSet</code> object to the given number of * rows. The fetch size gives a JDBC technology-enabled driver ("JDBC driver") * a hint as to the * number of rows that should be fetched from the database when more rows * are needed for this <code>RowSet</code> object. If the fetch size specified * is zero, the driver ignores the value and is free to make its own best guess * as to what the fetch size should be. * <P> * A <code>RowSet</code> object inherits the default properties of the * <code>ResultSet</code> object from which it got its data. That * <code>ResultSet</code> object's default fetch size is set by * the <code>Statement</code> object that created it. * <P> * This method applies to a <code>RowSet</code> object only while it is * connected to a database using a JDBC driver. * For connected <code>RowSet</code> implementations such as * <code>JdbcRowSet</code>, this method has a direct and immediate effect * on the underlying JDBC driver. * <P> * A <code>RowSet</code> object may use this method at any time to change * its setting for the fetch size. * <p> * For <code>RowSet</code> implementations such as * <code>CachedRowSet</code>, which operate in a disconnected environment, * the <code>SyncProvider</code> object being used * may leverage the fetch size to poll the data source and * retrieve a number of rows that do not exceed the fetch size and that may * form a subset of the actual rows returned by the original query. This is * an implementation variance determined by the specific <code>SyncProvider</code> * object employed by the disconnected <code>RowSet</code> object. * <P> * * @param rows the number of rows to fetch; <code>0</code> to let the * driver decide what the best fetch size is; must not be less * than <code>0</code> or more than the maximum number of rows * allowed for this <code>RowSet</code> object (the number returned * by a call to the method {@link #getMaxRows}) * @throws SQLException if the specified fetch size is less than <code>0</code> * or more than the limit for the maximum number of rows * @see #getFetchSize */ public void setFetchSize(int rows) throws SQLException { //Added this checking as maxRows can be 0 when this function is called //maxRows = 0 means rowset can hold any number of rows, os this checking // is needed to take care of this condition. if (getMaxRows() == 0 && rows >= 0) { fetchSize = rows; return; } if ((rows < 0) || (rows > getMaxRows())) { throw new SQLException("Invalid fetch size set. Cannot be of " + "value: " + rows); } fetchSize = rows; } /** * Returns the fetch size for this <code>RowSet</code> object. The default * value is zero. * * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object * needs more rows from the database * @throws SQLException if an error occurs determining the number of rows in the * current fetch size * @see #setFetchSize */ public int getFetchSize() throws SQLException { return fetchSize; } /** * Returns the concurrency for this <code>RowSet</code> object. * The default is <code>CONCUR_UPDATABLE</code> for both connected and * disconnected <code>RowSet</code> objects. * <P> * An application can call the method <code>setConcurrency</code> at any time * to change a <code>RowSet</code> object's concurrency. * <p> * @return the concurrency type for this <code>RowSet</code> * object, which must be one of the following: * <code>ResultSet.CONCUR_READ_ONLY</code> or * <code>ResultSet.CONCUR_UPDATABLE</code> * @throws SQLException if an error occurs getting the concurrency * of this <code>RowSet</code> object * @see #setConcurrency * @see #isReadOnly */ public int getConcurrency() throws SQLException { return concurrency; } //----------------------------------------------------------------------- // Parameters //----------------------------------------------------------------------- /** * Checks the given index to see whether it is less than <code>1</code> and * throws an <code>SQLException</code> object if it is. * <P> * This method is called by many methods internally; it is never * called by an application directly. * * @param idx an <code>int</code> indicating which parameter is to be * checked; the first parameter is <code>1</code> * @throws SQLException if the parameter is less than <code>1</code> */ private void checkParamIndex(int idx) throws SQLException { if ((idx < 1)) { throw new SQLException("Invalid Parameter Index");Lines 1001–1500 of 4512. Previous lines Load more
} this.concurrency = concurrency; } /** * Returns a <code>boolean</code> indicating whether this * <code>RowSet</code> object is read-only. * Any attempts to update a read-only <code>RowSet</code> object will result in an * <code>SQLException</code> being thrown. By default, * rowsets are updatable if updates are possible. * * @return <code>true</code> if this <code>RowSet</code> object * cannot be updated; <code>false</code> otherwise * @see #setConcurrency * @see #setReadOnly */ public boolean isReadOnly() { return readOnly; }; /** * Sets this <code>RowSet</code> object's readOnly property to the given <code>boolean</code>. * * @param value <code>true</code> to indicate that this * <code>RowSet</code> object is read-only; * <code>false</code> to indicate that it is updatable */ public void setReadOnly(boolean value) { readOnly = value; } /** * Returns the transaction isolation property for this * <code>RowSet</code> object's connection. This property represents * the transaction isolation level requested for use in transactions. * <P> * For <code>RowSet</code> implementations such as * the <code>CachedRowSet</code> that operate in a disconnected environment, * the <code>SyncProvider</code> object * offers complementary locking and data integrity options. The * options described below are pertinent only to connected <code>RowSet</code> * objects (<code>JdbcRowSet</code> objects). * * @return one of the following constants: * <code>Connection.TRANSACTION_NONE</code>, * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or * <code>Connection.TRANSACTION_SERIALIZABLE</code> * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncProvider * @see #setTransactionIsolation */ public int getTransactionIsolation() { return isolation; }; /** * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given * constant. The DBMS will use this transaction isolation level for * transactions if it can. * <p> * For <code>RowSet</code> implementations such as * the <code>CachedRowSet</code> that operate in a disconnected environment, * the <code>SyncProvider</code> object being used * offers complementary locking and data integrity options. The * options described below are pertinent only to connected <code>RowSet</code> * objects (<code>JdbcRowSet</code> objects). * * @param level one of the following constants, listed in ascending order: * <code>Connection.TRANSACTION_NONE</code>, * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or * <code>Connection.TRANSACTION_SERIALIZABLE</code> * @throws SQLException if the given parameter is not one of the Connection * constants * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncProvider * @see #getTransactionIsolation */ public void setTransactionIsolation(int level) throws SQLException { if ((level != Connection.TRANSACTION_NONE) && (level != Connection.TRANSACTION_READ_COMMITTED) && (level != Connection.TRANSACTION_READ_UNCOMMITTED) && (level != Connection.TRANSACTION_REPEATABLE_READ) && (level != Connection.TRANSACTION_SERIALIZABLE)) { throw new SQLException("Invalid transaction isolation set. Must " + "be either " + "Connection.TRANSACTION_NONE or " + "Connection.TRANSACTION_READ_UNCOMMITTED or " + "Connection.TRANSACTION_READ_COMMITTED or " + "Connection.RRANSACTION_REPEATABLE_READ or " + "Connection.TRANSACTION_SERIALIZABLE"); } this.isolation = level; } /** * Retrieves the type map associated with the <code>Connection</code> * object for this <code>RowSet</code> object. * <P> * Drivers that support the JDBC 3.0 API will create * <code>Connection</code> objects with an associated type map. * This type map, which is initially empty, can contain one or more * fully-qualified SQL names and <code>Class</code> objects indicating * the class to which the named SQL value will be mapped. The type mapping * specified in the connection's type map is used for custom type mapping * when no other type map supersedes it. * <p> * If a type map is explicitly supplied to a method that can perform * custom mapping, that type map supersedes the connection's type map. * * @return the <code>java.util.Map</code> object that is the type map * for this <code>RowSet</code> object's connection */ public java.util.Map<String,Class<?>> getTypeMap() { return map; } /** * Installs the given <code>java.util.Map</code> object as the type map * associated with the <code>Connection</code> object for this * <code>RowSet</code> object. The custom mapping indicated in * this type map will be used unless a different type map is explicitly * supplied to a method, in which case the type map supplied will be used. * * @param map a <code>java.util.Map</code> object that contains the * mapping from SQL type names for user defined types (UDT) to classes in * the Java programming language. Each entry in the <code>Map</code> * object consists of the fully qualified SQL name of a UDT and the * <code>Class</code> object for the <code>SQLData</code> implementation * of that UDT. May be <code>null</code>. */ public void setTypeMap(java.util.Map<String,Class<?>> map) { this.map = map; } /** * Retrieves the maximum number of bytes that can be used for a column * value in this <code>RowSet</code> object. * This limit applies only to columns that hold values of the * following types: <code>BINARY</code>, <code>VARBINARY</code>, * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess * data is silently discarded. * * @return an <code>int</code> indicating the current maximum column size * limit; zero means that there is no limit * @throws SQLException if an error occurs internally determining the * maximum limit of the column size */ public int getMaxFieldSize() throws SQLException { return maxFieldSize; } /** * Sets the maximum number of bytes that can be used for a column * value in this <code>RowSet</code> object to the given number. * This limit applies only to columns that hold values of the * following types: <code>BINARY</code>, <code>VARBINARY</code>, * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess * data is silently discarded. For maximum portability, it is advisable to * use values greater than 256. * * @param max an <code>int</code> indicating the new maximum column size * limit; zero means that there is no limit * @throws SQLException if (1) an error occurs internally setting the * maximum limit of the column size or (2) a size of less than 0 is set */ public void setMaxFieldSize(int max) throws SQLException { if (max < 0) { throw new SQLException("Invalid max field size set. Cannot be of " + "value: " + max); } maxFieldSize = max; } /** * Retrieves the maximum number of rows that this <code>RowSet</code> object may contain. If * this limit is exceeded, the excess rows are silently dropped. * * @return an <code>int</code> indicating the current maximum number of * rows; zero means that there is no limit * @throws SQLException if an error occurs internally determining the * maximum limit of rows that a <code>Rowset</code> object can contain */ public int getMaxRows() throws SQLException { return maxRows; } /** * Sets the maximum number of rows that this <code>RowSet</code> object may contain to * the given number. If this limit is exceeded, the excess rows are * silently dropped. * * @param max an <code>int</code> indicating the current maximum number * of rows; zero means that there is no limit * @throws SQLException if an error occurs internally setting the * maximum limit on the number of rows that a JDBC <code>RowSet</code> object * can contain; or if <i>max</i> is less than <code>0</code>; or * if <i>max</i> is less than the <code>fetchSize</code> of the * <code>RowSet</code> */ public void setMaxRows(int max) throws SQLException { if (max < 0) { throw new SQLException("Invalid max row size set. Cannot be of " + "value: " + max); } else if (max < this.getFetchSize()) { throw new SQLException("Invalid max row size set. Cannot be less " + "than the fetchSize."); } this.maxRows = max; } /** * Sets to the given <code>boolean</code> whether or not the driver will * scan for escape syntax and do escape substitution before sending SQL * statements to the database. The default is for the driver to do escape * processing. * <P> * Note: Since <code>PreparedStatement</code> objects have usually been * parsed prior to making this call, disabling escape processing for * prepared statements will likely have no effect. * * @param enable <code>true</code> to enable escape processing; * <code>false</code> to disable it * @throws SQLException if an error occurs setting the underlying JDBC * technology-enabled driver to process the escape syntax */ public void setEscapeProcessing(boolean enable) throws SQLException { escapeProcessing = enable; } /** * Retrieves the maximum number of seconds the driver will wait for a * query to execute. If the limit is exceeded, an <code>SQLException</code> * is thrown. * * @return the current query timeout limit in seconds; zero means that * there is no limit * @throws SQLException if an error occurs in determining the query * time-out value */ public int getQueryTimeout() throws SQLException { return queryTimeout; } /** * Sets to the given number the maximum number of seconds the driver will * wait for a query to execute. If the limit is exceeded, an * <code>SQLException</code> is thrown. * * @param seconds the new query time-out limit in seconds; zero means that * there is no limit; must not be less than zero * @throws SQLException if an error occurs setting the query * time-out or if the query time-out value is less than 0 */ public void setQueryTimeout(int seconds) throws SQLException { if (seconds < 0) { throw new SQLException("Invalid query timeout value set. Cannot be " + "of value: " + seconds); } this.queryTimeout = seconds; } /** * Retrieves a <code>boolean</code> indicating whether rows marked * for deletion appear in the set of current rows. * The default value is <code>false</code>. * <P> * Note: Allowing deleted rows to remain visible complicates the behavior * of some of the methods. However, most <code>RowSet</code> object users * can simply ignore this extra detail because only sophisticated * 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 an error occurs determining if deleted rows * are visible or not * @see #setShowDeleted */ public boolean getShowDeleted() throws SQLException { return showDeleted; } /** * 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. * * @param value <code>true</code> if deleted rows should be shown; * <code>false</code> otherwise * @throws SQLException if an error occurs setting whether deleted * rows are visible or not * @see #getShowDeleted */ public void setShowDeleted(boolean value) throws SQLException { showDeleted = value; } /** * Ascertains whether escape processing is enabled for this * <code>RowSet</code> object. * * @return <code>true</code> if escape processing is turned on; * <code>false</code> otherwise * @throws SQLException if an error occurs determining if escape * processing is enabled or not or if the internal escape * processing trigger has not been enabled */ public boolean getEscapeProcessing() throws SQLException { return escapeProcessing; } /** * Gives the driver a performance hint as to the direction in * which the rows in this <code>RowSet</code> object will be * processed. The driver may ignore this hint. * <P> * A <code>RowSet</code> object inherits the default properties of the * <code>ResultSet</code> object from which it got its data. That * <code>ResultSet</code> object's default fetch direction is set by * the <code>Statement</code> object that created it. * <P> * This method applies to a <code>RowSet</code> object only while it is * connected to a database using a JDBC driver. * <p> * A <code>RowSet</code> object may use this method at any time to change * its setting for the fetch direction. * * @param direction one of <code>ResultSet.FETCH_FORWARD</code>, * <code>ResultSet.FETCH_REVERSE</code>, or * <code>ResultSet.FETCH_UNKNOWN</code> * @throws SQLException if (1) the <code>RowSet</code> type is * <code>TYPE_FORWARD_ONLY</code> and the given fetch direction is not * <code>FETCH_FORWARD</code> or (2) the given fetch direction is not * one of the following: * ResultSet.FETCH_FORWARD, * ResultSet.FETCH_REVERSE, or * ResultSet.FETCH_UNKNOWN * @see #getFetchDirection */ public void setFetchDirection(int direction) throws SQLException { // Changed the condition checking to the below as there were two // conditions that had to be checked // 1. RowSet is TYPE_FORWARD_ONLY and direction is not FETCH_FORWARD // 2. Direction is not one of the valid values if (((getType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD)) || ((direction != ResultSet.FETCH_FORWARD) && (direction != ResultSet.FETCH_REVERSE) && (direction != ResultSet.FETCH_UNKNOWN))) { throw new SQLException("Invalid Fetch Direction"); } fetchDir = direction; } /** * Retrieves this <code>RowSet</code> object's current setting for the * fetch direction. The default type is <code>ResultSet.FETCH_FORWARD</code> * * @return one of <code>ResultSet.FETCH_FORWARD</code>, * <code>ResultSet.FETCH_REVERSE</code>, or * <code>ResultSet.FETCH_UNKNOWN</code> * @throws SQLException if an error occurs in determining the * current fetch direction for fetching rows * @see #setFetchDirection */ public int getFetchDirection() throws SQLException { //Added the following code to throw a //SQL Exception if the fetchDir is not //set properly.Bug id:4914155 // This checking is not necessary! /* if((fetchDir != ResultSet.FETCH_FORWARD) && (fetchDir != ResultSet.FETCH_REVERSE) && (fetchDir != ResultSet.FETCH_UNKNOWN)) { throw new SQLException("Fetch Direction Invalid"); } */ return (fetchDir); } /** * Sets the fetch size for this <code>RowSet</code> object to the given number of * rows. The fetch size gives a JDBC technology-enabled driver ("JDBC driver") * a hint as to the * number of rows that should be fetched from the database when more rows * are needed for this <code>RowSet</code> object. If the fetch size specified * is zero, the driver ignores the value and is free to make its own best guess * as to what the fetch size should be. * <P> * A <code>RowSet</code> object inherits the default properties of the * <code>ResultSet</code> object from which it got its data. That * <code>ResultSet</code> object's default fetch size is set by * the <code>Statement</code> object that created it. * <P> * This method applies to a <code>RowSet</code> object only while it is * connected to a database using a JDBC driver. * For connected <code>RowSet</code> implementations such as * <code>JdbcRowSet</code>, this method has a direct and immediate effect * on the underlying JDBC driver. * <P> * A <code>RowSet</code> object may use this method at any time to change * its setting for the fetch size. * <p> * For <code>RowSet</code> implementations such as * <code>CachedRowSet</code>, which operate in a disconnected environment, * the <code>SyncProvider</code> object being used * may leverage the fetch size to poll the data source and * retrieve a number of rows that do not exceed the fetch size and that may * form a subset of the actual rows returned by the original query. This is * an implementation variance determined by the specific <code>SyncProvider</code> * object employed by the disconnected <code>RowSet</code> object. * <P> * * @param rows the number of rows to fetch; <code>0</code> to let the * driver decide what the best fetch size is; must not be less * than <code>0</code> or more than the maximum number of rows * allowed for this <code>RowSet</code> object (the number returned * by a call to the method {@link #getMaxRows}) * @throws SQLException if the specified fetch size is less than <code>0</code> * or more than the limit for the maximum number of rows * @see #getFetchSize */ public void setFetchSize(int rows) throws SQLException { //Added this checking as maxRows can be 0 when this function is called //maxRows = 0 means rowset can hold any number of rows, os this checking // is needed to take care of this condition. if (getMaxRows() == 0 && rows >= 0) { fetchSize = rows; return; } if ((rows < 0) || (rows > getMaxRows())) { throw new SQLException("Invalid fetch size set. Cannot be of " + "value: " + rows); } fetchSize = rows; } /** * Returns the fetch size for this <code>RowSet</code> object. The default * value is zero. * * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object * needs more rows from the database * @throws SQLException if an error occurs determining the number of rows in the * current fetch size * @see #setFetchSize */ public int getFetchSize() throws SQLException { return fetchSize; } /** * Returns the concurrency for this <code>RowSet</code> object. * The default is <code>CONCUR_UPDATABLE</code> for both connected and * disconnected <code>RowSet</code> objects. * <P> * An application can call the method <code>setConcurrency</code> at any time * to change a <code>RowSet</code> object's concurrency. * <p> * @return the concurrency type for this <code>RowSet</code> * object, which must be one of the following: * <code>ResultSet.CONCUR_READ_ONLY</code> or * <code>ResultSet.CONCUR_UPDATABLE</code> * @throws SQLException if an error occurs getting the concurrency * of this <code>RowSet</code> object * @see #setConcurrency * @see #isReadOnly */ public int getConcurrency() throws SQLException { return concurrency; } //----------------------------------------------------------------------- // Parameters //----------------------------------------------------------------------- /** * Checks the given index to see whether it is less than <code>1</code> and * throws an <code>SQLException</code> object if it is. * <P> * This method is called by many methods internally; it is never * called by an application directly. * * @param idx an <code>int</code> indicating which parameter is to be * checked; the first parameter is <code>1</code> * @throws SQLException if the parameter is less than <code>1</code> */ private void checkParamIndex(int idx) throws SQLException { if ((idx < 1)) { throw new SQLException("Invalid Parameter Index");