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

📄 netstatementrequest.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        }        buildSQLDTAGRP(numColumns, lidAndLengthOverrides, overrideExists, overrideMap);        if (overrideExists) {            writeBytes(FdocaConstants.MDD_SQLDTA_TOSEND);        }        writeBytes(FdocaConstants.SQLDTA_RLO_TOSEND);    }    // Build the FDOCA SQLDTAGRP Late Group Descriptor.    // preconditions:    protected void buildSQLDTAGRP(int numVars,                                  int[][] lidAndLengthOverrides,                                  boolean mddRequired,                                  java.util.Hashtable overrideMap) throws SqlException {        int n = 0;        int offset = 0;        n = calculateColumnsInSQLDTAGRPtriplet(numVars);        buildTripletHeader(((3 * n) + 3),                FdocaConstants.NGDA_TRIPLET_TYPE,                FdocaConstants.SQLDTAGRP_LID);        do {            writeLidAndLengths(lidAndLengthOverrides, n, offset, mddRequired, overrideMap);            numVars -= n;            if (numVars == 0) {                break;            }            offset += n;            n = calculateColumnsInSQLDTAGRPtriplet(numVars);            buildTripletHeader(((3 * n) + 3),                    FdocaConstants.CPT_TRIPLET_TYPE,                    0x00);        } while (true);    }/////////// perf end    protected void buildOUTOVR(ResultSet resultSet,                               ColumnMetaData resultSetMetaData) throws SqlException {        createCommandData();        markLengthBytes(CodePoint.OUTOVR);        int[][] outputOverrides =                calculateOUTOVRLidAndLengthOverrides(resultSet, resultSetMetaData);        buildSQLDTARD(resultSetMetaData.columns_, outputOverrides);        updateLengthBytes();    }    private int[][] calculateOUTOVRLidAndLengthOverrides(ResultSet resultSet,                                                         ColumnMetaData resultSetMetaData) {        int numVars = resultSetMetaData.columns_;        int[][] lidAndLengths = new int[numVars][2]; //everything initialized to "default triplet"        return lidAndLengths;    }    protected void buildSQLDTARD(int numColumns, int[][] lidAndLengthOverrides) throws SqlException {        buildSQLCADTA(numColumns, lidAndLengthOverrides);        writeBytes(FdocaConstants.SQLDTARD_RLO_TOSEND);    }    protected void buildSQLCADTA(int numColumns, int[][] lidAndLengthOverrides) throws SqlException {        buildSQLDTAGRP(numColumns, lidAndLengthOverrides, false, null);  // false means no mdd override        writeBytes(FdocaConstants.SQLCADTA_RLO_TOSEND);    }    private void buildFDODTA(int numVars,                             int[][] protocolTypesAndLengths,                             Object[] inputs) throws SqlException {        long dataLength = 0;        Object o = null;        markLengthBytes(CodePoint.FDODTA);        write1Byte(FdocaConstants.NULL_LID); // write the 1-byte row indicator        // write data for each input column        for (int i = 0; i < numVars; i++) {            if (inputs[i] == null) {                if ((protocolTypesAndLengths[i][0] % 2) == 1) {                    write1Byte(FdocaConstants.NULL_DATA);                } else {                    //bug check                }            } else {                if ((protocolTypesAndLengths[i][0] % 2) == 1) {                    write1Byte(FdocaConstants.INDICATOR_NULLABLE);                }                switch (protocolTypesAndLengths[i][0] | 0x01) {  // mask out null indicator                case FdocaConstants.PROTOCOL_TYPE_NVARMIX:                case FdocaConstants.PROTOCOL_TYPE_NLONGMIX:                    // What to do for server that don't understand 1208 (UTF-8)                    // check for a promototed type, and use that instead if it exists                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                        writeSingleorMixedCcsidLDString((String) inputs[i], netAgent_.typdef_.getCcsidMbcEncoding());                    } else { // use the promototed object instead                        Clob c = (Clob) o;                        dataLength = c.length();                        setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    }                    break;                case FdocaConstants.PROTOCOL_TYPE_NVARCHAR:                case FdocaConstants.PROTOCOL_TYPE_NLONG:                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                    } else { // use the promototed object instead                        dataLength = ((Clob) o).length();                        setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    }                    break;                case FdocaConstants.PROTOCOL_TYPE_NINTEGER:                    writeIntFdocaData(((Integer) inputs[i]).intValue());                    break;                case FdocaConstants.PROTOCOL_TYPE_NSMALL:                    writeShortFdocaData(((Short) inputs[i]).shortValue());                    break;                case FdocaConstants.PROTOCOL_TYPE_NFLOAT4:                    writeFloat(((Float) inputs[i]).floatValue());                    break;                case FdocaConstants.PROTOCOL_TYPE_NFLOAT8:                    writeDouble(((Double) inputs[i]).doubleValue());                    break;                case FdocaConstants.PROTOCOL_TYPE_NDECIMAL:                    writeBigDecimal((java.math.BigDecimal) inputs[i],                            (protocolTypesAndLengths[i][1] >> 8) & 0xff, // described precision not actual                            protocolTypesAndLengths[i][1] & 0xff); // described scale, not actual                    break;                case FdocaConstants.PROTOCOL_TYPE_NDATE:                    writeDate((java.sql.Date) inputs[i]);                    break;                case FdocaConstants.PROTOCOL_TYPE_NTIME:                    writeTime((java.sql.Time) inputs[i]);                    break;                case FdocaConstants.PROTOCOL_TYPE_NTIMESTAMP:                    writeTimestamp((java.sql.Timestamp) inputs[i]);                    break;                case FdocaConstants.PROTOCOL_TYPE_NINTEGER8:                    writeLongFdocaData(((Long) inputs[i]).longValue());                    break;                case FdocaConstants.PROTOCOL_TYPE_NVARBYTE:                case FdocaConstants.PROTOCOL_TYPE_NLONGVARBYTE:                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                        writeLDBytes((byte[]) inputs[i]);                    } else { // use the promototed object instead                        Blob b = (Blob) o;                        dataLength = b.length();                        setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    }                    break;                case FdocaConstants.PROTOCOL_TYPE_NLOBCSBCS:                case FdocaConstants.PROTOCOL_TYPE_NLOBCDBCS:                    // check for a promoted Clob                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                        try {                            dataLength = ((java.sql.Clob) inputs[i]).length();                        } catch (java.sql.SQLException e) {                            if (!(e instanceof org.apache.derby.client.am.SqlException)) {                                SqlException toThrow = new SqlException(netAgent_.logWriter_,                                        "Error obtaining length of external clob object, exception follows. ");                                toThrow.setNextException(e);                                throw toThrow;                            } else {                                throw new SqlException(netAgent_.logWriter_, e, "Error obtaining length of blob object, exception follows. ");                            }                        }                    } else {                        dataLength = ((Clob) o).length();                    }                    setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    break;                case FdocaConstants.PROTOCOL_TYPE_NLOBBYTES:                    // check for a promoted Clob                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                        try {                            dataLength = ((java.sql.Blob) inputs[i]).length();                        } catch (java.sql.SQLException e) {                            if (!(e instanceof org.apache.derby.client.am.SqlException)) {                                SqlException toThrow = new SqlException(netAgent_.logWriter_,                                        "Error obtaining length of external blob object, exception follows. ");                                toThrow.setNextException(e);                                throw toThrow;                            } else {                                throw new SqlException(netAgent_.logWriter_, e, "Error obtaining length of blob object, exception follows. ");                            }                        }                    } else { // use promoted Blob                        dataLength = ((Blob) o).length();                    }                    setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    break;                case FdocaConstants.PROTOCOL_TYPE_NLOBCMIXED:                    // check for a promoted Clob                    o = retrievePromotedParameterIfExists(i);                    if (o == null) {                        if (((Clob) inputs[i]).isString()) {                            dataLength = ((Clob) inputs[i]).getUTF8Length();                        } else // must be a Unicode stream                        {                            dataLength = ((Clob) inputs[i]).length();                        }                    } else { // use promoted Clob                        dataLength = ((Clob) o).length();                    }                    setFDODTALobLength(protocolTypesAndLengths, i, dataLength);                    break;                default:                    throw new SqlException(netAgent_.logWriter_, "unrecognized jdbc type. " +                            " type: " + protocolTypesAndLengths[i][0] +                            ", columnCount: " + numVars +                            ", columnIndex: " + i);                }            }        }        updateLengthBytes(); // for fdodta    }    // preconditions:    private void buildEXTDTA(ColumnMetaData parameterMetaData,                             Object[] inputRow,                             boolean chained) throws SqlException {        // build the EXTDTA data, if necessary        if (extdtaPositions_ != null) {            boolean chainFlag, chainedWithSameCorrelator;            for (int i = 0; i < extdtaPositions_.size(); i++) {                int index = ((Integer) extdtaPositions_.get(i)).intValue();                // is this the last EXTDTA to be built?                if (i != extdtaPositions_.size() - 1) { // no                    chainFlag = true;                    chainedWithSameCorrelator = true;                } else { // yes                    chainFlag = chained;                    chainedWithSameCorrelator = false;                }                // do we have to write a null byte?                boolean writeNullByte = false;                if (parameterMetaData.nullable_[index]) {                    writeNullByte = true;                }                // Use the type of the input parameter rather than the input                // column if possible.                int parameterType = parameterMetaData.clientParamtertype_[index];                if (parameterType == 0) {                    parameterType = parameterMetaData.types_[index];                }                // the follow types are possible due to promotion to BLOB                if (parameterType == Types.BLOB                        || parameterType == Types.BINARY                        || parameterType == Types.VARBINARY                        || parameterType == Types.LONGVARBINARY) {                    Blob o = (Blob) retrievePromotedParameterIfExists(index);                    java.sql.Blob b = (o == null) ? (java.sql.Blob) inputRow[index] : o;                    boolean isExternalBlob = !(b instanceof org.apache.derby.client.am.Blob);                    if (isExternalBlob) {                        try {                            writeScalarStream(chainFlag,                                    chainedWithSameCorrelator,                                    CodePoint.EXTDTA,                                    (int) b.length(),                                    b.getBinaryStream(),                                    writeNullByte,                                    index + 1);                        } catch (java.sql.SQLException e) {                            if (!(e instanceof org.apache.derby.client.am.SqlException)) {                                SqlException toThrow = new SqlException(netAgent_.logWriter_, "Error occurred while streaming from external blob object, exception follows. ");                                toThrow.setNextException(e);                                throw toThrow;

⌨️ 快捷键说明

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