Package org.apache.derby.client.am

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


            if ( netResultSet_ != null ) { netResultSet_.markLOBAsPublished(column); }
        }
        // Check for locator
        int locator = locator(column);
        if (locator > 0) { // Create locator-based LOB object
            return new ClientBlob(agent, locator);
        }
       
        // The Blob value has been sent instead of locator
        int index = column - 1;
        int dataOffset;
        byte[] data;
        ClientBlob 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 ClientBlob(data, agent, dataOffset);
        } else {
            blob = new ClientBlob(new byte[0], agent, 0);
        }

        return blob;
    }
View Full Code Here


                    if (parameterType == ClientTypes.BLOB
                            || parameterType == ClientTypes.BINARY
                            || parameterType == ClientTypes.VARBINARY
                            || parameterType == ClientTypes.LONGVARBINARY) {

                        ClientBlob o =
                          (ClientBlob)retrievePromotedParameterIfExists(index);

                        Blob b = (o == null) ? (Blob) inputRow[index] : o;
                        boolean isExternalBlob = !(b instanceof ClientBlob);
                        if (isExternalBlob) {
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.
                        ClientBlob b = new ClientBlob(ba, netAgent_, 0);

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

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case 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.
                        ClientBlob b = new ClientBlob(ba, netAgent_, 0);

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

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case Types.JAVA_OBJECT:
                    lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NUDT;
                    lidAndLengths[i][1] = 32767;
                    break;
                case Types.BLOB:
                    Blob b = (Blob) inputRow[i];
                    if (b == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] =
                                buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
                    } else if (b instanceof ClientBlob &&
                               ((ClientBlob)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 ClientBlob &&
                                ( (ClientBlob) b).willBeLayerBStreamed() ){
                               
                                //Correspond to totalLength 0 as default length for unknown
                                lidAndLengths[i][1] = 0x8002;
                                   
                            }else {
                                lidAndLengths[i][1] = buildPlaceholderLength(b.length());
                               
                            }
                        } catch (SQLException e) {
                            throw new SqlException(netAgent_.logWriter_,
                                new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH), e);
View Full Code Here

TOP

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

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.