4512 lines · 210.7 KB · Java
RawDownload
     * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method     * as it is undefined in this class.     * <P>     * Calls made to the method <code>getParams</code> after this version of     * <code>setTime</code>     * has been called will return an array containing the parameter values that     * have been set.  In that array, the element that represents the values     * set with this method will itself be an array. The first element of that array     * is the given <code>java.sql.Time</code> object.     * The second element is the value set for <i>cal</i>.     * The parameter number is indicated by an element's position in the array     * returned by the method <code>getParams</code>,     * with the first element being the value for the first placeholder parameter, the     * second element being the value for the second placeholder parameter, and so on.     * In other words, if the time being set is the value for the second     * placeholder parameter, the array containing it will be the second element in     * the array returned by <code>getParams</code>.     * <P>     * Note that because the numbering of elements in an array starts at zero,     * the array element that corresponds to placeholder parameter number     * <i>parameterIndex</i> is <i>parameterIndex</i> -1.     *     * @param parameterIndex the ordinal number of the placeholder parameter     *        in this <code>RowSet</code> object's command that is to be set.     *        The first parameter is 1, the second is 2, and so on; must be     *        <code>1</code> or greater     * @param x a <code>java.sql.Time</code> object     * @param cal the <code>java.util.Calendar</code> object the driver can use to     *         construct the time     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException {        Object time[];        checkParamIndex(parameterIndex);         time = new Object[2];        time[0] = x;        time[1] = cal;        if(params == null){             throw new SQLException("Set initParams() before setTime");        }        params.put(Integer.valueOf(parameterIndex - 1), time);    }     /**     * Sets the designated parameter to the given     * <code>java.sql.Timestamp</code> object.  The driver converts this     * to an SQL <code>TIMESTAMP</code> value when it sends it to the database.     * <P>     * When the DBMS does not store time zone information, the driver will use     * the given <code>Calendar</code> object to construct the SQL <code>TIMESTAMP</code>     * value to send to the database. With a     * <code>Calendar</code> object, the driver can calculate the timestamp     * taking into account a custom time zone.  If no <code>Calendar</code>     * object is specified, the driver uses the time zone of the Virtual Machine     * that is running the application.     * <P>     * The parameter value set by this method is stored internally and     * will be supplied as the appropriate parameter in this <code>RowSet</code>     * object's command when the method <code>execute</code> is called.     * Methods such as <code>execute</code> and <code>populate</code> must be     * provided in any class that extends this class and implements one or     * more of the standard JSR-114 <code>RowSet</code> interfaces.     * <P>     * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method     * as it is undefined in this class.     * <P>     * Calls made to the method <code>getParams</code> after this version of     * <code>setTimestamp</code>     * has been called will return an array containing the parameter values that     * have been set.  In that array, the element that represents the values     * set with this method will itself be an array. The first element of that array     * is the given <code>java.sql.Timestamp</code> object.     * The second element is the value set for <i>cal</i>.     * The parameter number is indicated by an element's position in the array     * returned by the method <code>getParams</code>,     * with the first element being the value for the first placeholder parameter, the     * second element being the value for the second placeholder parameter, and so on.     * In other words, if the timestamp being set is the value for the second     * placeholder parameter, the array containing it will be the second element in     * the array returned by <code>getParams</code>.     * <P>     * Note that because the numbering of elements in an array starts at zero,     * the array element that corresponds to placeholder parameter number     * <i>parameterIndex</i> is <i>parameterIndex</i> -1.     *     * @param parameterIndex the ordinal number of the placeholder parameter     *        in this <code>RowSet</code> object's command that is to be set.     *        The first parameter is 1, the second is 2, and so on; must be     *        <code>1</code> or greater     * @param x a <code>java.sql.Timestamp</code> object     * @param cal the <code>java.util.Calendar</code> object the driver can use to     *         construct the timestamp     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException {        Object timestamp[];        checkParamIndex(parameterIndex);         timestamp = new Object[2];        timestamp[0] = x;        timestamp[1] = cal;        if(params == null){             throw new SQLException("Set initParams() before setTimestamp");        }        params.put(Integer.valueOf(parameterIndex - 1), timestamp);    }     /**     * Clears all of the current parameter values in this <code>RowSet</code>     * object's internal representation of the parameters to be set in     * this <code>RowSet</code> object's command when it is executed.     * <P>     * In general, parameter values remain in force for repeated use in     * this <code>RowSet</code> object's command. Setting a parameter value with the     * setter methods automatically clears the value of the     * designated parameter and replaces it with the new specified value.     * <P>     * This method is called internally by the <code>setCommand</code>     * method to clear all of the parameters set for the previous command.     * <P>     * Furthermore, this method differs from the <code>initParams</code>     * method in that it maintains the schema of the <code>RowSet</code> object.     *     * @throws SQLException if an error occurs clearing the parameters     */    public void clearParameters() throws SQLException {        params.clear();    }     /**     * Retrieves an array containing the parameter values (both Objects and     * primitives) that have been set for this     * <code>RowSet</code> object's command and throws an <code>SQLException</code> object     * if all parameters have not been set.   Before the command is sent to the     * DBMS to be executed, these parameters will be substituted     * for placeholder parameters in the  <code>PreparedStatement</code> object     * that is the command for a <code>RowSet</code> implementation extending     * the <code>BaseRowSet</code> class.     * <P>     * Each element in the array that is returned is an <code>Object</code> instance     * that contains the values of the parameters supplied to a setter method.     * The order of the elements is determined by the value supplied for     * <i>parameterIndex</i>.  If the setter method takes only the parameter index     * and the value to be set (possibly null), the array element will contain the value to be set     * (which will be expressed as an <code>Object</code>).  If there are additional     * parameters, the array element will itself be an array containing the value to be set     * plus any additional parameter values supplied to the setter method. If the method     * sets a stream, the array element includes the type of stream being supplied to the     * method. These additional parameters are for the use of the driver or the DBMS and may or     * may not be used.     * <P>     * NOTE: Stored parameter values of types <code>Array</code>, <code>Blob</code>,     * <code>Clob</code> and <code>Ref</code> are returned as <code>SerialArray</code>,     * <code>SerialBlob</code>, <code>SerialClob</code> and <code>SerialRef</code>     * respectively.     *     * @return an array of <code>Object</code> instances that includes the     *         parameter values that may be set in this <code>RowSet</code> object's     *         command; an empty array if no parameters have been set     * @throws SQLException if an error occurs retrieveing the object array of     *         parameters of this <code>RowSet</code> object or if not all parameters have     *         been set     */    public Object[] getParams() throws SQLException {        if (params == null) {             initParams();            Object [] paramsArray = new Object[params.size()];            return paramsArray;         } else {            // The parameters may be set in random order            // but all must be set, check to verify all            // have been set till the last parameter            // else throw exception.             Object[] paramsArray = new Object[params.size()];            for (int i = 0; i < params.size(); i++) {               paramsArray[i] = params.get(Integer.valueOf(i));               if (paramsArray[i] == null) {                 throw new SQLException("missing parameter: " + (i + 1));               } //end if            } //end for            return paramsArray;         } //end if     } //end getParams   /**    * Sets the designated parameter to SQL <code>NULL</code>.    *    * <P><B>Note:</B> You must specify the parameter's SQL type.    *    * @param parameterName the name of the parameter    * @param sqlType the SQL type code defined in <code>java.sql.Types</code>    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @since 1.4    */   public void setNull(String parameterName, int sqlType) throws SQLException {        throw new SQLFeatureNotSupportedException("Feature not supported");   }   /**    * Sets the designated parameter to SQL <code>NULL</code>.    * This version of the method <code>setNull</code> should    * be used for user-defined types and REF type parameters.  Examples    * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and    * named array types.    *    * <P><B>Note:</B> To be portable, applications must give the    * SQL type code and the fully-qualified SQL type name when specifying    * a NULL user-defined or REF parameter.  In the case of a user-defined type    * the name is the type name of the parameter itself.  For a REF    * parameter, the name is the type name of the referenced type.  If    * a JDBC driver does not need the type code or type name information,    * it may ignore it.    *    * Although it is intended for user-defined and Ref parameters,    * this method may be used to set a null parameter of any JDBC type.    * If the parameter does not have a user-defined or REF type, the given    * typeName is ignored.    *    *    * @param parameterName the name of the parameter    * @param sqlType a value from <code>java.sql.Types</code>    * @param typeName the fully-qualified name of an SQL user-defined type;    *        ignored if the parameter is not a user-defined type or    *        SQL <code>REF</code> value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @since 1.4    */   public void setNull (String parameterName, int sqlType, String typeName)       throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given Java <code>boolean</code> value.    * The driver converts this    * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setBoolean(String parameterName, boolean x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given Java <code>byte</code> value.    * The driver converts this    * to an SQL <code>TINYINT</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setByte(String parameterName, byte x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given Java <code>short</code> value.    * The driver converts this    * to an SQL <code>SMALLINT</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setShort(String parameterName, short x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }   /**    * Sets the designated parameter to the given Java <code>int</code> value.    * The driver converts this    * to an SQL <code>INTEGER</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setInt(String parameterName, int x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }   /**    * Sets the designated parameter to the given Java <code>long</code> value.    * The driver converts this    * to an SQL <code>BIGINT</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setLong(String parameterName, long x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }   /**    * Sets the designated parameter to the given Java <code>float</code> value.    * The driver converts this    * to an SQL <code>FLOAT</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setFloat(String parameterName, float x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }   /**    * Sets the designated parameter to the given Java <code>double</code> value.    * The driver converts this    * to an SQL <code>DOUBLE</code> value when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setDouble(String parameterName, double x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given    * <code>java.math.BigDecimal</code> value.    * The driver converts this to an SQL <code>NUMERIC</code> value when    * it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given Java <code>String</code> value.    * The driver converts this    * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value    * (depending on the argument's    * size relative to the driver's limits on <code>VARCHAR</code> values)    * when it sends it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setString(String parameterName, String x) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given Java array of bytes.    * The driver converts this to an SQL <code>VARBINARY</code> or    * <code>LONGVARBINARY</code> (depending on the argument's size relative    * to the driver's limits on <code>VARBINARY</code> values) when it sends    * it to the database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setBytes(String parameterName, byte x[]) throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.    * The driver    * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the    * database.    *    * @param parameterName the name of the parameter    * @param x the parameter value    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @see #getParams    * @since 1.4    */   public void setTimestamp(String parameterName, java.sql.Timestamp x)       throws SQLException{        throw new SQLFeatureNotSupportedException("Feature not supported");   }    /**    * Sets the designated parameter to the given input stream, which will have    * the specified number of bytes.    * When a very large ASCII value is input to a <code>LONGVARCHAR</code>    * parameter, it may be more practical to send it via a    * <code>java.io.InputStream</code>. Data will be read from the stream    * as needed until end-of-file is reached.  The JDBC driver will    * do any necessary conversion from ASCII to the database char format.    *    * <P><B>Note:</B> This stream object can either be a standard    * Java stream object or your own subclass that implements the    * standard interface.    *    * @param parameterName the name of the parameter    * @param x the Java input stream that contains the ASCII parameter value    * @param length the number of bytes in the stream    * @exception SQLException if a database access error occurs or    * this method is called on a closed <code>CallableStatement</code>    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support    * this method    * @since 1.4    */   public void setAsciiStream(String parameterName, java.io.InputStream x, int length)       throws SQLException{

Lines 3001–3500 of 4512. Previous lines