resultset.java

来自「derby database source code.good for you.」· Java 代码 · 共 1,556 行 · 第 1/5 页

JAVA
1,556
字号
            try {                result = new java.io.ByteArrayInputStream                        (((String) agent_.crossConverters_.setObject(java.sql.Types.CHAR,                                updatedColumns_[column - 1])).getBytes("UTF-8"));            } catch (java.io.UnsupportedEncodingException e) {                throw new SqlException(agent_.logWriter_, e, e.getMessage());            }        } else {            result = isNull(column) ? null : cursor_.getUnicodeStream(column);        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceDeprecatedExit(this, "getUnicodeStream", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public java.io.Reader getCharacterStream(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getCharacterStream", column);        }        checkGetterPreconditions(column);        java.io.Reader result = null;        if (wasNonNullSensitiveUpdate(column)) {            result = new java.io.StringReader                    ((String) agent_.crossConverters_.setObject(java.sql.Types.CHAR, updatedColumns_[column - 1]));        } else {            result = isNull(column) ? null : cursor_.getCharacterStream(column);        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getCharacterStream", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public java.sql.Blob getBlob(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getBlob", column);        }        checkGetterPreconditions(column);        java.sql.Blob result = null;        if (wasNonNullSensitiveUpdate(column)) {            result = (java.sql.Blob) agent_.crossConverters_.setObject(java.sql.Types.BLOB,                    updatedColumns_[column - 1]);        } else {            result = isNull(column) ? null : cursor_.getBlob(column);        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getBlob", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public java.sql.Clob getClob(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getClob", column);        }        checkGetterPreconditions(column);        java.sql.Clob result = null;        if (wasNonNullSensitiveUpdate(column)) {            result = (java.sql.Clob) agent_.crossConverters_.setObject(java.sql.Types.CLOB,                    updatedColumns_[column - 1]);        } else {            result = isNull(column) ? null : cursor_.getClob(column);        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getClob", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public java.sql.Ref getRef(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getRef", column);        }        checkGetterPreconditions(column);        java.sql.Ref result = isNull(column) ? null : cursor_.getRef(column);        if (true) {            throw new SqlException(agent_.logWriter_, "jdbc 2 method not yet implemented");        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getRef", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public java.sql.Array getArray(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getArray", column);        }        checkGetterPreconditions(column);        java.sql.Array result = isNull(column) ? null : cursor_.getArray(column);        if (true) {            throw new SqlException(agent_.logWriter_, "jdbc 2 method not yet implemented");        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getArray", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public Object getObject(int column) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getObject", column);        }        Object result = getObjectX(column);        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getObject", result);        }        return result;    }    // used by DBMD    Object getObjectX(int column) throws SqlException {        checkGetterPreconditions(column);        Object result = null;        if (wasNonNullSensitiveUpdate(column)) {            result = updatedColumns_[column - 1];        } else {            result = isNull(column) ? null : cursor_.getObject(column);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    // Live life on the edge and run unsynchronized    public Object getObject(int column, java.util.Map map) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getObject", column, map);        }        checkGetterPreconditions(column);        Object result = null;        if (wasNonNullSensitiveUpdate(column)) {            result = updatedColumns_[column - 1];        } else {            result = isNull(column) ? null : cursor_.getObject(column);        }        if (true) {            throw new SqlException(agent_.logWriter_, "jdbc 2 method not yet implemented");        }        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceExit(this, "getObject", result);        }        setWasNull(column);  // Placed close to the return to minimize risk of thread interference        return result;    }    //----------------------------------------------------------------------------    // This method only returns true if there is a new non-null updated value.    // If the resultset is updatable, sensitive, and updated, return the new non-null updated value.    // Otherwise this method will return false.    // If the column is updated to null, or if the column has not been update but is null,    // a null will be returned by isNull(), which first calls wasNullSensitiveUpdate() to check for a column    // that is updated to null, and columnUpdated_ is checked there.    private boolean wasNonNullSensitiveUpdate(int column) {        return                updatedColumns_ != null &&                updatedColumns_[column - 1] != null;    }    // if updatedColumns_ entry is null, but columnUpdated_ entry    // indicates column has been updated, then column is updated to null.    private boolean wasNullSensitiveUpdate(int column) {        return                resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE &&                updatedColumns_ != null &&                updatedColumns_[column - 1] == null &&                columnUpdated_[column - 1];    }    private void setWasNull(int column) {        if (wasNullSensitiveUpdate(column)) {            wasNull_ = WAS_NULL;        } else {            wasNull_ = (cursor_.isNull_ == null || cursor_.isNull_[column - 1]) ? WAS_NULL : WAS_NOT_NULL;        }    }    private boolean isNull(int column) {        if (wasNullSensitiveUpdate(column)) {            return true;        } else {            return (cursor_.isUpdateDeleteHole_ == true || cursor_.isNull_[column - 1]);        }    }    // ------------- Methods for accessing results by column name ----------------    public final boolean getBoolean(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getBoolean", columnName);        }        return getBoolean(findColumnX(columnName));    }    public final byte getByte(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getByte", columnName);        }        return getByte(findColumnX(columnName));    }    public final short getShort(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getShort", columnName);        }        return getShort(findColumnX(columnName));    }    public final int getInt(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getInt", columnName);        }        return getInt(findColumnX(columnName));    }    public final long getLong(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getLong", columnName);        }        return getLong(findColumnX(columnName));    }    public final float getFloat(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getFloat", columnName);        }        return getFloat(findColumnX(columnName));    }    public final double getDouble(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getDouble", columnName);        }        return getDouble(findColumnX(columnName));    }    public final java.math.BigDecimal getBigDecimal(String columnName, int scale) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceDeprecatedEntry(this, "getBigDecimal", columnName, scale);        }        return getBigDecimal(findColumnX(columnName), scale);    }    public final java.math.BigDecimal getBigDecimal(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getBigDecimal", columnName);        }        return getBigDecimal(findColumnX(columnName));    }    public final java.sql.Date getDate(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getDate", columnName);        }        return getDate(findColumnX(columnName));    }    public final java.sql.Date getDate(String columnName, java.util.Calendar cal) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getDate", columnName, cal);        }        return getDate(findColumnX(columnName), cal);    }    public final java.sql.Time getTime(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getTime", columnName);        }        return getTime(findColumnX(columnName));    }    public final java.sql.Time getTime(String columnName, java.util.Calendar cal) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getTime", columnName, cal);        }        return getTime(findColumnX(columnName), cal);    }    public final java.sql.Timestamp getTimestamp(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getTimestamp", columnName);        }        return getTimestamp(findColumnX(columnName));    }    public final java.sql.Timestamp getTimestamp(String columnName, java.util.Calendar cal) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getTimestamp", columnName, cal);        }        return getTimestamp(findColumnX(columnName), cal);    }    public final String getString(String columnName) throws SqlException {        if (agent_.loggingEnabled()) {            agent_.logWriter_.traceEntry(this, "getString", columnName);        }        return getString(findColumnX(columnName));    }

⌨️ 快捷键说明

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