4512 lines · 210.7 KB · Java
RawDownload
        }    }     //---------------------------------------------------------------------    // setter methods for setting the parameters in a <code>RowSet</code> object's command    //---------------------------------------------------------------------     /**     * Sets the designated parameter to SQL <code>NULL</code>.     * Note that the parameter's SQL type must be specified using one of the         * type codes defined in <code>java.sql.Types</code>.  This SQL type is     * specified in the second parameter.     * <p>     * Note that the second parameter tells the DBMS the data type of the value being     * set to <code>NULL</code>. Some DBMSs require this information, so it is required     * in order to make code more portable.     * <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>setNull</code>     * has been called will return an <code>Object</code> 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 <code>null</code>.     * The second element is the value set for <i>sqlType</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 second placeholder parameter is being set to     * <code>null</code>, 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 sqlType an <code>int</code> that is one of the SQL type codes     *        defined in the class {@link java.sql.Types}. If a non-standard     *        <i>sqlType</i> is supplied, this method will not throw a     *        <code>SQLException</code>. This allows implicit support for     *        non-standard SQL types.     * @throws SQLException if a database access error occurs or the given     *        parameter index is out of bounds     * @see #getParams     */    public void setNull(int parameterIndex, int sqlType) throws SQLException {        Object nullVal[];        checkParamIndex(parameterIndex);         nullVal = new Object[2];        nullVal[0] = null;        nullVal[1] = Integer.valueOf(sqlType);        if (params == null){            throw new SQLException("Set initParams() before setNull");       }         params.put(Integer.valueOf(parameterIndex - 1), nullVal);    }     /**     * Sets the designated parameter to SQL <code>NULL</code>.     *     * Although this version of the  method <code>setNull</code> is intended     * for user-defined     * and <code>REF</code> parameters, this method may be used to set a null     * parameter for any JDBC type. The following are user-defined types:     * <code>STRUCT</code>, <code>DISTINCT</code>, and <code>JAVA_OBJECT</code>,     * 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 <code>NULL</code> user-defined or <code>REF</code> parameter.     * In the case of a user-defined type, the name is the type name of     * the parameter itself.  For a <code>REF</code> parameter, the name is     * the type name of the referenced type.  If a JDBC technology-enabled     * driver does not need the type code or type name information,     * it may ignore it.     * <P>     * If the parameter does not have a user-defined or <code>REF</code> type,     * the given <code>typeName</code> parameter is ignored.     * <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>setNull</code>     * has been called will return an <code>Object</code> 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 <code>null</code>.     * The second element is the value set for <i>sqlType</i>, and the third     * element is the value set for <i>typeName</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 second placeholder parameter is being set to     * <code>null</code>, 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 sqlType a value from <code>java.sql.Types</code>     * @param typeName the fully qualified name of an SQL user-defined type,     *                 which is ignored if the parameter is not a user-defined     *                 type or <code>REF</code> value     * @throws SQLException if an error occurs or the given parameter index     *            is out of bounds     * @see #getParams     */    public void setNull(int parameterIndex, int sqlType, String typeName)        throws SQLException {         Object nullVal[];        checkParamIndex(parameterIndex);         nullVal = new Object[3];        nullVal[0] = null;        nullVal[1] = Integer.valueOf(sqlType);        nullVal[2] = typeName;        if(params == null){            throw new SQLException("Set initParams() before setNull");       }         params.put(Integer.valueOf(parameterIndex - 1), nullVal);    }      /**     * Sets the designated parameter to the given <code>boolean</code> in the     * Java programming language.  The driver converts this to an SQL     * <code>BIT</code> value when it sends it to the database.     * <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>, <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setBoolean(int parameterIndex, boolean x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){            throw new SQLException("Set initParams() before setNull");       }         params.put(Integer.valueOf(parameterIndex - 1), Boolean.valueOf(x));    }     /**     * Sets the designated parameter to the given <code>byte</code> in the Java     * programming language.  The driver converts this to an SQL     * <code>TINYINT</code> value when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setByte(int parameterIndex, byte x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){            throw new SQLException("Set initParams() before setByte");       }         params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x));    }     /**     * Sets the designated parameter to the given <code>short</code> in the     * Java programming language.  The driver converts this to an SQL     * <code>SMALLINT</code> value when it sends it to the database.     * <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>     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setShort(int parameterIndex, short x) throws SQLException {        checkParamIndex(parameterIndex);         if(params == null){             throw new SQLException("Set initParams() before setShort");        }         params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x));    }     /**     * Sets the designated parameter to an <code>int</code> in the Java     * programming language.  The driver converts this to an SQL     * <code>INTEGER</code> value when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setInt(int parameterIndex, int x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setInt");        }        params.put(Integer.valueOf(parameterIndex - 1), Integer.valueOf(x));    }     /**     * Sets the designated parameter to the given <code>long</code> in the Java     * programming language.  The driver converts this to an SQL     * <code>BIGINT</code> value when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setLong(int parameterIndex, long x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setLong");        }        params.put(Integer.valueOf(parameterIndex - 1), Long.valueOf(x));    }     /**     * Sets the designated parameter to the given <code>float</code> in the     * Java programming language.  The driver converts this to an SQL     * <code>FLOAT</code> value when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setFloat(int parameterIndex, float x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setFloat");        }        params.put(Integer.valueOf(parameterIndex - 1), new Float(x));    }     /**     * Sets the designated parameter to the given <code>double</code> in the     * Java programming language.  The driver converts this to an SQL     * <code>DOUBLE</code> value when it sends it to the database.     * <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.     * S     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setDouble(int parameterIndex, double x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setDouble");        }        params.put(Integer.valueOf(parameterIndex - 1), new Double(x));    }     /**     * Sets the designated parameter to the given     * <code>java.lang.BigDecimal</code> value.  The driver converts this to     * an SQL <code>NUMERIC</code> value when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setBigDecimal");        }        params.put(Integer.valueOf(parameterIndex - 1), x);    }     /**     * Sets the designated parameter to the given <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.     * <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>     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setString(int parameterIndex, String x) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setString");        }        params.put(Integer.valueOf(parameterIndex - 1), x);    }     /**     * Sets the designated parameter to the given array of bytes.     * The driver converts this to an SQL     * <code>VARBINARY</code> or <code>LONGVARBINARY</code> value     * (depending on the argument's size relative to the driver's limits     * on <code>VARBINARY</code> values) when it sends it to the database.     * <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.     *     * @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 the parameter value     * @throws SQLException if an error occurs or the     *                         parameter index is out of bounds     * @see #getParams     */    public void setBytes(int parameterIndex, byte x[]) throws SQLException {        checkParamIndex(parameterIndex);        if(params == null){             throw new SQLException("Set initParams() before setBytes");        }        params.put(Integer.valueOf(parameterIndex - 1), x);    }     /**     * Sets the designated parameter to the given <code>java.sql.Date</code>     * value. The driver converts this to an SQL     * <code>DATE</code> value when it sends it to the database.     * <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

Lines 1501–2000 of 4512. Previous lines