Package org.apache.derby.client.am

Examples of org.apache.derby.client.am.Blob


                    // 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,
View Full Code Here


                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absence of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.LONGVARBINARY:
                    ba = (byte[]) inputRow[i];
                    if (ba == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absensce of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.BLOB:
                    java.sql.Blob b = (java.sql.Blob) inputRow[i];
                    if (b == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] =
                                buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
                    } else if (b instanceof Blob && ((Blob)b).isLocator()){
                        //we are sending locators.
                        //Here the LID local identifier in the FDODSC
                        //FD:OCA descriptor should be initialized as
                        //to contain a BLOB locator.
                        lidAndLengths[i][0] =
                                    DRDAConstants.DRDA_TYPE_NLOBLOC;
                        lidAndLengths[i][1] = 4;
                    } else {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        try {
                           
                            if( b instanceof Blob &&
                                ( (Blob) b).willBeLayerBStreamed() ){
                               
                                //Correspond to totalLength 0 as default length for unknown
                                lidAndLengths[i][1] = 0x8002;
                                   
                            }else {
                                lidAndLengths[i][1] = buildPlaceholderLength(b.length());
                               
                            }
                        } catch (java.sql.SQLException e) {
                            throw new SqlException(netAgent_.logWriter_,
                                new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH), e);
View Full Code Here

            netResultSet_.markLOBAsAccessed(column);
        }
        // Check for locator
        int locator = locator(column);
        if (locator > 0) { // Create locator-based LOB object
            return new Blob(agent, locator);
        }
       
        // The Blob value has been sent instead of locator
        int index = column - 1;
        int dataOffset;
        byte[] data;
        Blob blob = null;

        // locate the EXTDTA bytes, if any
        data = findExtdtaData(column);

        if (data != null) {
            // data found
            // set data offset based on the presence of a null indicator
            if (!nullable_[index]) {
                dataOffset = 0;
            } else {
                dataOffset = 1;
            }

            blob = new Blob(data, agent, dataOffset);
        } else {
            blob = new Blob(new byte[0], agent, 0);
        }

        return blob;
    }
View Full Code Here

                    case DRDAConstants.DRDA_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 DRDAConstants.DRDA_TYPE_NLOBCSBCS:
                    case DRDAConstants.DRDA_TYPE_NLOBCDBCS:
View Full Code Here

                    // 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,
View Full Code Here

                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absence of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.LONGVARBINARY:
                    ba = (byte[]) inputRow[i];
                    if (ba == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absensce of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.BLOB:
                    java.sql.Blob b = (java.sql.Blob) inputRow[i];
                    if (b == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] =
                                buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
                    } else {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        try {
                            lidAndLengths[i][1] = buildPlaceholderLength(b.length());
                        } catch (java.sql.SQLException e) {
                            throw new SqlException(netAgent_.logWriter_,
                                new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH), e);
                        }
                    }
View Full Code Here

    public Blob getBlobColumn_(int column, Agent agent) throws SqlException {
        int index = column - 1;
        int dataOffset;
        byte[] data;
        Blob blob = null;

        // locate the EXTDTA bytes, if any
        data = findExtdtaData(column);

        if (data != null) {
            // data found
            // set data offset based on the presence of a null indicator
            if (!nullable_[index]) {
                dataOffset = 0;
            } else {
                dataOffset = 1;
            }

            blob = new Blob(data, agent, dataOffset);
        } else {
            blob = new Blob(new byte[0], agent, 0);
        }

        return blob;
    }
View Full Code Here

                    // 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,
View Full Code Here

                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absence of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.LONGVARBINARY:
                    ba = (byte[]) inputRow[i];
                    if (ba == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absensce of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.BLOB:
                    java.sql.Blob b = (java.sql.Blob) inputRow[i];
                    if (b == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] =
                                buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
                    } else if (b instanceof Blob && ((Blob)b).isLocator()){
                        //we are sending locators.
                        //Here the LID local identifier in the FDODSC
                        //FD:OCA descriptor should be initialized as
                        //to contain a BLOB locator.
                        lidAndLengths[i][0] =
                                    DRDAConstants.DRDA_TYPE_NLOBLOC;
                        lidAndLengths[i][1] = 4;
                    } else {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        try {
                           
                            if( b instanceof Blob &&
                                ( (Blob) b).willBeLayerBStreamed() ){
                               
                                //Correspond to totalLength 0 as default length for unknown
                                lidAndLengths[i][1] = 0x8002;
                                   
                            }else {
                                lidAndLengths[i][1] = buildPlaceholderLength(b.length());
                               
                            }
                        } catch (java.sql.SQLException e) {
                            throw new SqlException(netAgent_.logWriter_,
                                new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH), e);
View Full Code Here

                    // 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,
View Full Code Here

TOP

Related Classes of org.apache.derby.client.am.Blob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.