Package org.h2.jdbc

Class JdbcClob

  • All Implemented Interfaces:
    java.sql.Clob, java.sql.NClob

    public final class JdbcClob
    extends JdbcLob
    implements java.sql.NClob
    Represents a CLOB value.
    • Constructor Detail

      • JdbcClob

        public JdbcClob​(JdbcConnection conn,
                        Value value,
                        JdbcLob.State state,
                        int id)
        INTERNAL
        Parameters:
        conn - it belongs to
        value - of
        state - of the LOB
        id - of the trace object
    • Method Detail

      • length

        public long length()
                    throws java.sql.SQLException
        Returns the length.
        Specified by:
        length in interface java.sql.Clob
        Returns:
        the length
        Throws:
        java.sql.SQLException
      • truncate

        public void truncate​(long len)
                      throws java.sql.SQLException
        [Not supported] Truncates the object.
        Specified by:
        truncate in interface java.sql.Clob
        Throws:
        java.sql.SQLException
      • getAsciiStream

        public java.io.InputStream getAsciiStream()
                                           throws java.sql.SQLException
        Returns the input stream.
        Specified by:
        getAsciiStream in interface java.sql.Clob
        Returns:
        the input stream
        Throws:
        java.sql.SQLException
      • setAsciiStream

        public java.io.OutputStream setAsciiStream​(long pos)
                                            throws java.sql.SQLException
        [Not supported] Returns an output stream.
        Specified by:
        setAsciiStream in interface java.sql.Clob
        Throws:
        java.sql.SQLException
      • getCharacterStream

        public java.io.Reader getCharacterStream()
                                          throws java.sql.SQLException
        Description copied from class: JdbcLob
        Returns the reader.
        Specified by:
        getCharacterStream in interface java.sql.Clob
        Overrides:
        getCharacterStream in class JdbcLob
        Returns:
        the reader
        Throws:
        java.sql.SQLException - on failure
      • setCharacterStream

        public java.io.Writer setCharacterStream​(long pos)
                                          throws java.sql.SQLException
        Get a writer to update the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The Clob is created in a separate thread, and the object is only updated when Writer.close() is called. The position must be 1, meaning the whole Clob data is set.
        Specified by:
        setCharacterStream in interface java.sql.Clob
        Parameters:
        pos - where to start writing (the first character is at position 1)
        Returns:
        a writer
        Throws:
        java.sql.SQLException
      • getSubString

        public java.lang.String getSubString​(long pos,
                                             int length)
                                      throws java.sql.SQLException
        Returns a substring.
        Specified by:
        getSubString in interface java.sql.Clob
        Parameters:
        pos - the position (the first character is at position 1)
        length - the number of characters
        Returns:
        the string
        Throws:
        java.sql.SQLException
      • setString

        public int setString​(long pos,
                             java.lang.String str)
                      throws java.sql.SQLException
        Fills the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The position must be 1, meaning the whole Clob data is set.
        Specified by:
        setString in interface java.sql.Clob
        Parameters:
        pos - where to start writing (the first character is at position 1)
        str - the string to add
        Returns:
        the length of the added text
        Throws:
        java.sql.SQLException - on failure
      • setString

        public int setString​(long pos,
                             java.lang.String str,
                             int offset,
                             int len)
                      throws java.sql.SQLException
        Fills the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The position must be 1, meaning the whole Clob data is set.
        Specified by:
        setString in interface java.sql.Clob
        Parameters:
        pos - where to start writing (the first character is at position 1)
        str - the string to add
        offset - the string offset
        len - the number of characters to read
        Returns:
        the length of the added text
        Throws:
        java.sql.SQLException
      • position

        public long position​(java.lang.String pattern,
                             long start)
                      throws java.sql.SQLException
        [Not supported] Searches a pattern and return the position.
        Specified by:
        position in interface java.sql.Clob
        Throws:
        java.sql.SQLException
      • position

        public long position​(java.sql.Clob clobPattern,
                             long start)
                      throws java.sql.SQLException
        [Not supported] Searches a pattern and return the position.
        Specified by:
        position in interface java.sql.Clob
        Throws:
        java.sql.SQLException
      • getCharacterStream

        public java.io.Reader getCharacterStream​(long pos,
                                                 long length)
                                          throws java.sql.SQLException
        Returns the reader, starting from an offset.
        Specified by:
        getCharacterStream in interface java.sql.Clob
        Parameters:
        pos - 1-based offset
        length - length of requested area
        Returns:
        the reader
        Throws:
        java.sql.SQLException