Package org.apache.derby.iapi.jdbc

Examples of org.apache.derby.iapi.jdbc.CharacterStreamDescriptor$Builder


                new CharacterStreamDescriptor.Builder().bufferable(true).
                byteLength(byteLength).charLength(charLength).
                curBytePos(curBytePos).curCharPos(curCharPos).
                dataOffset(dataOffset).maxCharLength(maxCharLen).
                stream(emptyStream);
        CharacterStreamDescriptor csd1 = b1.build();
        CharacterStreamDescriptor.Builder b2 =
                new CharacterStreamDescriptor.Builder().copyState(csd1);
        CharacterStreamDescriptor csd2 = b2.build();

        // Test the values.
        assertEquals(csd2.isBufferable(), csd1.isBufferable());
        assertEquals(csd2.isPositionAware(), csd1.isPositionAware());
        assertEquals(csd2.getDataOffset(), csd1.getDataOffset());
        assertEquals(csd2.getCurBytePos(), csd1.getCurBytePos());
        assertEquals(csd2.getCurCharPos(), csd1.getCurCharPos());
        assertEquals(csd2.getByteLength(), csd1.getByteLength());
        assertEquals(csd2.getCharLength(), csd1.getCharLength());
        assertEquals(csd2.getMaxCharLength(), csd1.getMaxCharLength());
        assertTrue(csd2.getStream() == csd1.getStream());

        // Override one value.
        CharacterStreamDescriptor.Builder b3 =
                new CharacterStreamDescriptor.Builder().copyState(csd1).
                maxCharLength(8765);
        CharacterStreamDescriptor csd3 = b3.build();
        assertEquals(8765, csd3.getMaxCharLength());

        // Demonstrate that copying the state after setting a value explicitly
        // overwrites the the set value.
        CharacterStreamDescriptor.Builder b4 =
                new CharacterStreamDescriptor.Builder().
                maxCharLength(8765).
                copyState(csd1);
        CharacterStreamDescriptor csd4 = b4.build();
        assertEquals(csd1.getMaxCharLength(), csd4.getMaxCharLength());
    }
View Full Code Here


        // The fake stream uses ascii. Add header and EOF marker.
        super.initialByteLength = CLOBLENGTH + headerLength;
        super.bytesPerChar = BYTES_PER_CHAR;
        EmbedStatement embStmt = (EmbedStatement)createStatement();
        InputStream is = new FakeStoreStream(CLOBLENGTH);
        CharacterStreamDescriptor csd =
                new CharacterStreamDescriptor.Builder().stream(is).
                    charLength(initialCharLength).byteLength(0L).
                    curCharPos(CharacterStreamDescriptor.BEFORE_FIRST).
                    dataOffset(2L).build();
        iClob = new StoreStreamClob(csd, embStmt);
View Full Code Here

        // The fake stream uses ascii. Add header and EOF marker.
        super.initialByteLength = CLOBLENGTH + headerLength;
        super.bytesPerChar = BYTES_PER_CHAR;
        EmbedStatement embStmt = (EmbedStatement)createStatement();
        InputStream is = new FakeStoreStream(CLOBLENGTH);
        CharacterStreamDescriptor csd =
                new CharacterStreamDescriptor.Builder().stream(is).
                    charLength(initialCharLength).byteLength(0L).
                    curCharPos(CharacterStreamDescriptor.BEFORE_FIRST).
                    dataOffset(2L).build();
        iClob = new StoreStreamClob(csd, embStmt);
View Full Code Here

            SanityManager.ASSERT(!dvd.isNull(),
                                 "clob is created on top of a null column");

        // See if a String or a stream will be the source of the Clob.
        if (dvd.hasStream()) {
            CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
            /*
             We are expecting this stream to be a FormatIdInputStream with an
             OverflowInputStream inside. FormatIdInputStream implements
             Resetable, as does OverflowInputStream. This should be the case
             when retrieving data from a long column. However, SQLChar, which is
             the class implementing the getStream() method for dvd.getStream(),
             does not guarantee this for us. In particular, the logging system
             (see StoredPage.logColumn) calls setStream with an argument that
             is sometimes a RememberBytesInputStream on a SQLChar object
             (e.g. see test repStreaming.sql). However, such a SQLChar
             object is going to the log buffer, NOT back to the user, so it
             should not break the ASSERT below.
             */
            if (SanityManager.DEBUG)
                SanityManager.ASSERT(csd.getStream() instanceof Resetable);

            try {
                this.clob = new StoreStreamClob(csd, this);
            } catch (StandardException se) {
                if (se.getMessageId().equals(SQLState.DATA_CONTAINER_CLOSED)) {
View Full Code Here

                    }
                    pushStack = true;
                    setupContextStack();

                    if (param.hasStream()) {
                        CharacterStreamDescriptor csd =
                            param.getStreamWithDescriptor();
                        reader = new UTF8Reader(csd, this, syncObject);
                    } else {
                        reader = new StringReader(param.getString());
                    }
View Full Code Here

      pushStack = true;
      setupContextStack();

            java.io.Reader ret; // The reader we will return to the user
            if (dvd.hasStream()) {
                CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
                // See if we have to enforce a max field size.
                if (lmfs > 0) {
                    csd = new CharacterStreamDescriptor.Builder().copyState(csd).
                            maxCharLength(lmfs).build();
                }
View Full Code Here

      pushStack = true;
      setupContextStack();

            java.io.Reader ret; // The reader we will return to the user
            if (dvd.hasStream()) {
                CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
                // See if we have to enforce a max field size.
                if (lmfs > 0) {
                    csd = new CharacterStreamDescriptor.Builder().copyState(csd).
                            maxCharLength(lmfs).build();
                }
View Full Code Here

      pushStack = true;
      setupContextStack();

            java.io.Reader ret; // The reader we will return to the user
            if (dvd.hasStream()) {
                CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
                // See if we have to enforce a max field size.
                if (lmfs > 0) {
                    csd = new CharacterStreamDescriptor.Builder().copyState(csd).
                            maxCharLength(lmfs).build();
                }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.jdbc.CharacterStreamDescriptor$Builder

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.