⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultset.java

📁 在资料浩瀚的互联网中
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            } catch (ArrayIndexOutOfBoundsException aioobEx) {                throw new SQLException(Messages.getString(                        "ResultSet.Column_Index_out_of_range",                        new Object[] {                            new Integer(columnIndex),                            new Integer(this.fields.length)                        }), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$            }            if (this.wasNullFlag) {                return null;            }            return (byte[]) this.thisRow[columnIndex - 1];        }        return getNativeBytes(columnIndex, noConversion);    }    /**     * DOCUMENT ME!     *     * @param columnName DOCUMENT ME!     *     * @return DOCUMENT ME!     *     * @throws SQLException DOCUMENT ME!     */    public byte[] getBytes(String columnName) throws SQLException {        return getBytes(findColumn(columnName));    }    //--------------------------JDBC 2.0-----------------------------------    //---------------------------------------------------------------------    // Getter's and Setter's    //---------------------------------------------------------------------    /**     * JDBC 2.0     *     * <p>     * Get the value of a column in the current row as a java.io.Reader.     * </p>     *     * @param columnIndex the column to get the value from     *     * @return the value in the column as a java.io.Reader.     *     * @throws SQLException if an error occurs     */    public java.io.Reader getCharacterStream(int columnIndex)        throws SQLException {        if (!this.isBinaryEncoded) {            String stringVal = getString(columnIndex);            if (stringVal != null) {                return new StringReader(stringVal);            }            return null;        }        return getNativeCharacterStream(columnIndex);    }    /**     * JDBC 2.0     *     * <p>     * Get the value of a column in the current row as a java.io.Reader.     * </p>     *     * @param columnName the column name to retrieve the value from     *     * @return the value as a java.io.Reader     *     * @throws SQLException if an error occurs     */    public java.io.Reader getCharacterStream(String columnName)        throws SQLException {        return getCharacterStream(findColumn(columnName));    }    /**     * JDBC 2.0 Get a CLOB column.     *     * @param i the first column is 1, the second is 2, ...     *     * @return an object representing a CLOB     *     * @throws SQLException if an error occurs     */    public java.sql.Clob getClob(int i) throws SQLException {        if (!this.isBinaryEncoded) {            return new com.mysql.jdbc.Clob(getString(i));        }        return getNativeClob(i);    }    /**     * JDBC 2.0 Get a CLOB column.     *     * @param colName the column name     *     * @return an object representing a CLOB     *     * @throws SQLException if an error occurs     */    public java.sql.Clob getClob(String colName) throws SQLException {        return getClob(findColumn(colName));    }    /**     * JDBC 2.0 Return the concurrency of this result set.  The concurrency     * used is determined by the statement that created the result set.     *     * @return the concurrency type, CONCUR_READ_ONLY, etc.     *     * @throws SQLException if a database-access error occurs     */    public int getConcurrency() throws SQLException {        return (CONCUR_READ_ONLY);    }    /**     * Get the name of the SQL cursor used by this ResultSet     *     * <p>     * In SQL, a result table is retrieved though a cursor that is named.  The     * current row of a result can be updated or deleted using a positioned     * update/delete statement that references the cursor name.     * </p>     *     * <p>     * JDBC supports this SQL feature by providing the name of the SQL cursor     * used by a ResultSet.  The current row of a ResulSet is also the current     * row of this SQL cursor.     * </p>     *     * <p>     * <B>Note:</B> If positioned update is not supported, a SQLException is     * thrown.     * </p>     *     * @return the ResultSet's SQL cursor name.     *     * @exception SQLException if a database access error occurs     */    public String getCursorName() throws SQLException {        throw new SQLException(Messages.getString(                "ResultSet.Positioned_Update_not_supported"),            SQLError.SQL_STATE_DRIVER_NOT_CAPABLE); //$NON-NLS-1$    }    /**     * Get the value of a column in the current row as a java.sql.Date object     *     * @param columnIndex the first column is 1, the second is 2...     *     * @return the column value; null if SQL NULL     *     * @exception java.sql.SQLException if a database access error occurs     */    public java.sql.Date getDate(int columnIndex) throws java.sql.SQLException {        return getDate(columnIndex, null);    }    /**     * DOCUMENT ME!     *     * @param columnName DOCUMENT ME!     *     * @return DOCUMENT ME!     *     * @throws java.sql.SQLException DOCUMENT ME!     */    public java.sql.Date getDate(String columnName)        throws java.sql.SQLException {        return getDate(findColumn(columnName));    }    /**     * JDBC 2.0 Get the value of a column in the current row as a java.sql.Date     * object.  Use the calendar to construct an appropriate millisecond value     * for the Date, if the underlying database doesn't store timezone     * information.     *     * @param columnIndex the first column is 1, the second is 2, ...     * @param cal the calendar to use in constructing the date     *     * @return the column value; if the value is SQL NULL, the result is null     *     * @exception SQLException if a database-access error occurs.     */    public java.sql.Date getDate(int columnIndex, Calendar cal)        throws SQLException {        if (this.isBinaryEncoded) {            return getNativeDate(columnIndex,                (cal != null) ? cal.getTimeZone() : this.getDefaultTimeZone());        }        String stringVal = getStringInternal(columnIndex, false);        if (stringVal == null) {            return null;        }        return getDateFromString(stringVal, columnIndex);    }    /**     * Get the value of a column in the current row as a java.sql.Date object.     * Use the calendar to construct an appropriate millisecond value for the     * Date, if the underlying database doesn't store timezone information.     *     * @param columnName is the SQL name of the column     * @param cal the calendar to use in constructing the date     *     * @return the column value; if the value is SQL NULL, the result is null     *     * @exception SQLException if a database-access error occurs.     */    public java.sql.Date getDate(String columnName, Calendar cal)        throws SQLException {        return getDate(findColumn(columnName), cal);    }    /**     * Get the value of a column in the current row as a Java double.     *     * @param columnIndex the first column is 1, the second is 2,...     *     * @return the column value; 0 if SQL NULL     *     * @exception SQLException if a database access error occurs     */    public double getDouble(int columnIndex) throws SQLException {        if (!this.isBinaryEncoded) {            return getDoubleInternal(columnIndex);        }        return getNativeDouble(columnIndex);    }    /**     * DOCUMENT ME!     *     * @param columnName DOCUMENT ME!     *     * @return DOCUMENT ME!     *     * @throws SQLException DOCUMENT ME!     */    public double getDouble(String columnName) throws SQLException {        return getDouble(findColumn(columnName));    }    /**     * JDBC 2.0 Give a hint as to the direction in which the rows in this     * result set will be processed.  The initial value is determined by the     * statement that produced the result set.  The fetch direction may be     * changed at any time.     *     * @param direction the direction to fetch rows in.     *     * @exception SQLException if a database-access error occurs, or the result     *            set type is TYPE_FORWARD_ONLY and direction is not     *            FETCH_FORWARD. MM.MySQL actually ignores this, because it     *            has the whole result set anyway, so the direction is     *            immaterial.     */    public void setFetchDirection(int direction) throws SQLException {        if ((direction != FETCH_FORWARD) && (direction != FETCH_REVERSE) &&                (direction != FETCH_UNKNOWN)) {            throw new SQLException(Messages.getString(                    "ResultSet.Illegal_value_for_fetch_direction_64"),                SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$        }        this.fetchDirection = direction;    }    /**     * JDBC 2.0 Returns the fetch direction for this result set.     *     * @return the fetch direction for this result set.     *     * @exception SQLException if a database-access error occurs     */    public int getFetchDirection() throws SQLException {        return this.fetchDirection;    }    /**     * JDBC 2.0 Give the JDBC driver a hint as to the number of rows that     * should be fetched from the database when more rows are needed for this     * result set.  If the fetch size specified is zero, then the JDBC driver     * ignores the value, and is free to make its own best guess as to what     * the fetch size should be.  The default value is set by the statement     * that creates the result set.  The fetch size may be changed at any     * time.     *     * @param rows the number of rows to fetch     *     * @exception SQLException if a database-access error occurs, or the     *            condition 0 lteq rows lteq this.getMaxRows() is not     *            satisfied. Currently ignored by this driver.     */    public void setFetchSize(int rows) throws SQLException {        if (rows < 0) { /* || rows > getMaxRows()*/            throw new SQLException(Messages.getString(                    "ResultSet.Value_must_be_between_0_and_getMaxRows()_66"), //$NON-NLS-1$                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);        }        this.fetchSize = rows;    }    /**     * JDBC 2.0 Return the fetch size for this result set.     *     * @return the fetch size for this result set.     *     * @exception SQLException if a database-access error occurs     */    public int getFetchSize() throws SQLException {        return this.fetchSize;    }    /**     * JDBC 2.0     *     * <p>     * Determine if the cursor is on the first row of the result set.     * </p>     *     * @return true if on the first row, false otherwise.     *     * @exception SQLException if a database-access error occurs.     */    public boolean isFirst() throws SQLException {    	checkClosed();    	        return this.rowData.isFirst();    }    /**     * Get the value of a column in the current row as a Java float.     *     * @param columnIndex the first column is 1, the second is 2,...     *     * @return the column value; 0 if SQL NULL     *     * @exception SQLException if a database access error occurs     */    public float getFloat(int columnIndex) throws SQLException {        if (!this.isBinaryEncoded) {            String val = null;            val = getString(columnIndex);                        return getFloatFromString(val, columnIndex);        }        return getNativeFloat(columnIndex);    }    /**     * DOCUMENT ME!     *     * @param columnName DOCUMENT ME!     *     * @return DOCUMENT ME!     *     * @throws SQLException DOCUMENT ME!     */    public float getFloat(String columnName) throws SQLException {        return getFloat(findColumn(columnName));    }    /**     * Get the value of a column in the current row as a Java int.     *     * @param columnIndex the first column is 1, the second is 2,...     *     * @return the column value; 0 if SQL NULL     *     * @exception SQLException if a database access error occurs     */    public int getInt(int columnIndex) throws SQLException {        if (!this.isBinaryEncoded) {            if (this.connection.getUseFastIntParsing()) {                checkRowPos();                try {                    if (this.thisRow[columnIndex - 1] == null) {                        this.wasNullFlag = true;                    } else {                        this.wasNullFlag = false;                    }                } catch (NullPointerException E) {                    this.wasNullFlag = true;                } catch (ArrayIndexOutOfBoundsException aioobEx) {                    throw new SQLException(Messages.getString(                            "ResultSet.Column_Index_out_of_range",                            new Object[] {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -