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

📄 cursor.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        return org.apache.derby.client.am.SignedBinary.getLong(dataBuffer_,                columnDataPosition_[column - 1]);    }    // Build a Java float from a 4-byte floating point representation.    private final float get_FLOAT(int column) {        return org.apache.derby.client.am.FloatingPoint.getFloat(dataBuffer_,                columnDataPosition_[column - 1]);    }    // Build a Java double from an 8-byte floating point representation.    private final double get_DOUBLE(int column) {        return org.apache.derby.client.am.FloatingPoint.getDouble(dataBuffer_,                columnDataPosition_[column - 1]);    }    // Build a java.math.BigDecimal from a fixed point decimal byte representation.    private final java.math.BigDecimal get_DECIMAL(int column) throws SqlException {        try {            return org.apache.derby.client.am.Decimal.getBigDecimal(dataBuffer_,                    columnDataPosition_[column - 1],                    getColumnPrecision(column - 1),                    getColumnScale(column - 1));        } catch (java.io.UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e, "Encoding is unsupported for conversion to BigDecimal");        }    }    // Build a Java double from a fixed point decimal byte representation.    private final double getDoubleFromDECIMAL(int column) throws SqlException {        try {            return org.apache.derby.client.am.Decimal.getDouble(dataBuffer_,                    columnDataPosition_[column - 1],                    getColumnPrecision(column - 1),                    getColumnScale(column - 1));        } catch (java.lang.IllegalArgumentException e) {            throw new SqlException(agent_.logWriter_, e, "Decimal value is out of range for conversion to double");        } catch (java.io.UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e, "Encoding is unsupported for conversion to BigDecimal");        }    }    // Build a Java long from a fixed point decimal byte representation.    private final long getLongFromDECIMAL(int column) throws SqlException {        try {            return org.apache.derby.client.am.Decimal.getLong(dataBuffer_,                    columnDataPosition_[column - 1],                    getColumnPrecision(column - 1),                    getColumnScale(column - 1));        } catch (java.lang.IllegalArgumentException e) {            throw new SqlException(agent_.logWriter_, e, "Decimal value is out of range for conversion to long");        } catch (java.io.UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e, "Encoding is unsupported for conversion to BigDecimal");        }    }    // Build a Java String from a database VARCHAR or LONGVARCHAR field.    //    // Depending on the ccsid, length is the number of chars or number of bytes.    // For 2-byte character ccsids, length is the number of characters,    // for all other cases length is the number of bytes.    // The length does not include the null terminator.    private final String getVARCHAR(int column) throws SqlException {        String tempString = null;        try {            if (ccsid_[column - 1] == 1200) {                return getStringWithoutConvert(columnDataPosition_[column - 1] + 2, columnDataComputedLength_[column - 1] - 2);            }            // check for null encoding is needed because the net layer            // will no longer throw an exception if the server didn't specify            // a mixed or double byte ccsid (ccsid = 0).  this check for null in the            // cursor is only required for types which can have mixed or double            // byte ccsids.            if (charsetName_[column - 1] == null) {                throw new SqlException(agent_.logWriter_,                        "Required character converter not available for data type.");            }            tempString = new String(dataBuffer_,                    columnDataPosition_[column - 1] + 2,                    columnDataComputedLength_[column - 1] - 2,                    charsetName_[column - 1]);            return (maxFieldSize_ == 0) ? tempString :                    tempString.substring(0, java.lang.Math.min(maxFieldSize_, tempString.length()));        } catch (java.io.UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e, "unsupported encoding for result set column " + column);        }    }    // Build a Java String from a database CHAR field.    private final String getCHAR(int column) throws SqlException {        String tempString = null;        if (ccsid_[column - 1] == 1200) {            return getStringWithoutConvert(columnDataPosition_[column - 1], columnDataComputedLength_[column - 1]);        }        try {            // check for null encoding is needed because the net layer            // will no longer throw an exception if the server didn't specify            // a mixed or double byte ccsid (ccsid = 0).  this check for null in the            // cursor is only required for types which can have mixed or double            // byte ccsids.            if (charsetName_[column - 1] == null) {                throw new SqlException(agent_.logWriter_,                        "Required character converter not available for data type.");            }            tempString = new String(dataBuffer_,                    columnDataPosition_[column - 1],                    columnDataComputedLength_[column - 1],                    charsetName_[column - 1]);            return (maxFieldSize_ == 0) ? tempString :                    tempString.substring(0, java.lang.Math.min(maxFieldSize_, tempString.length()));        } catch (java.io.UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e, "unsupported encoding for result set column " + column);        }    }    // Build a JDBC Date object from the DERBY ISO DATE field.    private final java.sql.Date getDATE(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.dateBytesToDate(dataBuffer_,                columnDataPosition_[column - 1],                recyclableDate_,                 charsetName_[column - 1]);        }catch (UnsupportedEncodingException e) {             throw new SqlException(agent_.logWriter_, e,                     "Encoding is unsupported for conversion to DATE");        }            }    // Build a JDBC Time object from the DERBY ISO TIME field.    private final java.sql.Time getTIME(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.timeBytesToTime(dataBuffer_,                    columnDataPosition_[column - 1],                    recyclableTime_,                    charsetName_[column - 1]);        } catch (UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e,                     "Encoding is unsupported for conversion to TIME");        }    }    // Build a JDBC Timestamp object from the DERBY ISO TIMESTAMP field.    private final java.sql.Timestamp getTIMESTAMP(int column) throws SqlException {        try {        return org.apache.derby.client.am.DateTime.timestampBytesToTimestamp(                dataBuffer_,                columnDataPosition_[column - 1],                recyclableTimestamp_,                 charsetName_[column - 1]);    } catch (java.io.UnsupportedEncodingException e) {        throw new SqlException(agent_.logWriter_, e,                 "Encoding is unsupported for conversion to TIMESTAMP");    }    }    // Build a JDBC Timestamp object from the DERBY ISO DATE field.    private final java.sql.Timestamp getTimestampFromDATE(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.dateBytesToTimestamp(dataBuffer_,                    columnDataPosition_[column - 1],                    recyclableTimestamp_,                     charsetName_[column -1]);        } catch (UnsupportedEncodingException e) {              throw new SqlException(agent_.logWriter_, e,                       "Encoding is unsupported for conversion to TIMESTAMP");                    }    }    // Build a JDBC Timestamp object from the DERBY ISO TIME field.    private final java.sql.Timestamp getTimestampFromTIME(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.timeBytesToTimestamp(dataBuffer_,                    columnDataPosition_[column - 1],                    recyclableTimestamp_,                    charsetName_[column -1]);        } catch (UnsupportedEncodingException e) {            throw new SqlException(agent_.logWriter_, e,                     "Encoding is unsupported for conversion to TIMESTAMP");        }    }    // Build a JDBC Date object from the DERBY ISO TIMESTAMP field.    private final java.sql.Date getDateFromTIMESTAMP(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.timestampBytesToDate(dataBuffer_,                    columnDataPosition_[column - 1],                    recyclableDate_,                    charsetName_[column -1]);        } catch (UnsupportedEncodingException e) {             throw new SqlException(agent_.logWriter_, e,                      "Encoding is unsupported for conversion to DATE");        }    }    // Build a JDBC Time object from the DERBY ISO TIMESTAMP field.    private final java.sql.Time getTimeFromTIMESTAMP(int column) throws SqlException {        try {            return org.apache.derby.client.am.DateTime.timestampBytesToTime(dataBuffer_,                    columnDataPosition_[column - 1],                    recyclableTime_,                    charsetName_[column -1]);        } catch (UnsupportedEncodingException e) {             throw new SqlException(agent_.logWriter_, e,                      "Encoding is unsupported for conversion to TIME");        }    }    private final String getStringFromDATE(int column) throws SqlException {        return getDATE(column).toString();    }    // Build a string object from the DERBY byte TIME representation.    private final String getStringFromTIME(int column) throws SqlException {        return getTIME(column).toString();    }    // Build a string object from the DERBY byte TIMESTAMP representation.    private final String getStringFromTIMESTAMP(int column) throws SqlException {        return getTIMESTAMP(column).toString();    }    // Extract bytes from a database java.sql.Types.BINARY field.    // This is the DERBY type CHAR(n) FOR BIT DATA.    private final byte[] get_CHAR_FOR_BIT_DATA(int column) throws SqlException {        // There is no limit to the size of a column if maxFieldSize is zero.        // Otherwise, use the smaller of maxFieldSize and the actual column length.        int columnLength = (maxFieldSize_ == 0) ? columnDataComputedLength_[column - 1] :                java.lang.Math.min(maxFieldSize_, columnDataComputedLength_[column - 1]);        byte[] bytes = new byte[columnLength];        System.arraycopy(dataBuffer_, columnDataPosition_[column - 1], bytes, 0, columnLength);        return bytes;    }    // Extract bytes from a database java.sql.Types.VARBINARY or LONGVARBINARY field.    // This includes the DERBY types:    //   VARCHAR(n) FOR BIT DATA    //   LONG VARCHAR(n) FOR BIT DATA    private final byte[] get_VARCHAR_FOR_BIT_DATA(int column) throws SqlException {        byte[] bytes;        int columnLength = 0;        columnLength = (maxFieldSize_ == 0) ? columnDataComputedLength_[column - 1] - 2 :                java.lang.Math.min(maxFieldSize_, columnDataComputedLength_[column - 1] - 2);        bytes = new byte[columnLength];        System.arraycopy(dataBuffer_, columnDataPosition_[column - 1] + 2, bytes, 0, bytes.length);        return bytes;    }    abstract public Blob getBlobColumn_(int column, Agent agent) throws SqlException;    abstract public Clob getClobColumn_(int column, Agent agent) throws SqlException;    // get the raw clob bytes, without translation.  dataOffset must be int[1]    abstract public byte[] getClobBytes_(int column, int[] dataOffset /*output*/) throws SqlException;    //------- the following getters perform any necessary cross-conversion _------    final boolean getBoolean(int column) throws SqlException {        switch (jdbcTypes_[column - 1]) {        case java.sql.Types.SMALLINT:            return agent_.crossConverters_.getBooleanFromShort(get_SMALLINT(column));        case java.sql.Types.INTEGER:            return agent_.crossConverters_.getBooleanFromInt(get_INTEGER(column));        case java.sql.Types.BIGINT:            return agent_.crossConverters_.getBooleanFromLong(get_BIGINT(column));        case java.sql.Types.REAL:            return agent_.crossConverters_.getBooleanFromFloat(get_FLOAT(column));        case java.sql.Types.DOUBLE:            return agent_.crossConverters_.getBooleanFromDouble(get_DOUBLE(column));        case java.sql.Types.DECIMAL:            // For performance we don't materialize the BigDecimal, but convert directly from decimal bytes to a long.            return agent_.crossConverters_.getBooleanFromLong(getLongFromDECIMAL(column));

⌨️ 快捷键说明

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