Package org.apache.derby.iapi.jdbc

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


      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


            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();

            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

        // never should get this far
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(!dvd.isNull(),
                                 "clob is created on top of a null column");

        CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
        // See if a String or a stream will be the source of the Clob.
        if (csd == null) {
            try {
                clob = new TemporaryClob(dvd.getString(),
                        this);
            }
            catch (SQLException sqle) {
                throw StandardException.newException (sqle.getSQLState(), sqle);
            }
            catch (IOException e) {
                throw StandardException.newException (
                                        SQLState.SET_STREAM_FAILURE, e);
            }
        } else {
            /*
             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

      if (wasNull = dvd.isNull()) { return null; }

      pushStack = true;
      setupContextStack();

            CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();

            if (csd == null) {

        String val = dvd.getString();
        if (lmfs > 0) {
View Full Code Here

        // never should get this far
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(!dvd.isNull(),
                                 "clob is created on top of a null column");

        CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
        // See if a String or a stream will be the source of the Clob.
        if (csd == null) {
            try {
                clob = new TemporaryClob(dvd.getString(),
                        this);
            }
            catch (SQLException sqle) {
                throw StandardException.newException (sqle.getSQLState(), sqle);
            }
            catch (IOException e) {
                throw StandardException.newException (
                                        SQLState.SET_STREAM_FAILURE, e);
            }
        } else {
            /*
             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

                        break;
                    }
                    pushStack = true;
                    setupContextStack();

                    CharacterStreamDescriptor csd =
                            param.getStreamWithDescriptor();
                    if (csd == null) {
                        reader = new StringReader(param.getString());
                    } else {
                        reader = new UTF8Reader(csd, this, syncObject);
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

     */
    public void testDefaultValues() {
        InputStream emptyStream = new ByteArrayInputStream(new byte[] {});
        CharacterStreamDescriptor.Builder b =
                new CharacterStreamDescriptor.Builder().stream(emptyStream);
        CharacterStreamDescriptor csd = b.build();

        // Test the default values.
        assertEquals(false, csd.isBufferable());
        assertEquals(false, csd.isPositionAware());
        assertEquals(0, csd.getDataOffset());
        assertEquals(0, csd.getCurBytePos());
        assertEquals(1, csd.getCurCharPos());
        assertEquals(0, csd.getByteLength());
        assertEquals(0, csd.getCharLength());
        assertEquals(Long.MAX_VALUE, csd.getMaxCharLength());
    }
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.