Class TextRowDecoder

  • All Implemented Interfaces:
    RowDecoder

    public class TextRowDecoder
    extends java.lang.Object
    implements RowDecoder
    TEXT rows decoder
    • Constructor Detail

      • TextRowDecoder

        public TextRowDecoder()
    • Method Detail

      • decode

        public <T> T decode​(Codec<T> codec,
                            java.util.Calendar cal,
                            StandardReadableByteBuf rowBuf,
                            MutableInt fieldLength,
                            ColumnDecoder[] metadataList,
                            MutableInt fieldIndex,
                            Context context)
                     throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to data type.
        Specified by:
        decode in interface RowDecoder
        Type Parameters:
        T - Codec default return type
        Parameters:
        codec - current codec
        cal - calendar
        rowBuf - row buffer
        fieldLength - field length
        metadataList - metadatas
        fieldIndex - field index
        context - connection context
        Returns:
        default object according to metadata
        Throws:
        java.sql.SQLException - if any decoding error occurs
      • defaultDecode

        public java.lang.Object defaultDecode​(ColumnDecoder[] metadataList,
                                              MutableInt fieldIndex,
                                              StandardReadableByteBuf rowBuf,
                                              MutableInt fieldLength,
                                              Context context)
                                       throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to data type.
        Specified by:
        defaultDecode in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        context - connection context
        Returns:
        data
        Throws:
        java.sql.SQLException - if any decoding error occurs
      • decodeString

        public java.lang.String decodeString​(ColumnDecoder[] metadataList,
                                             MutableInt fieldIndex,
                                             StandardReadableByteBuf rowBuf,
                                             MutableInt fieldLength,
                                             Context context)
                                      throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to String.
        Specified by:
        decodeString in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        context - connection Context
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to String value
      • decodeByte

        public byte decodeByte​(ColumnDecoder[] metadataList,
                               MutableInt fieldIndex,
                               StandardReadableByteBuf rowBuf,
                               MutableInt fieldLength)
                        throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to byte.
        Specified by:
        decodeByte in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to byte value
      • decodeBoolean

        public boolean decodeBoolean​(ColumnDecoder[] metadataList,
                                     MutableInt fieldIndex,
                                     StandardReadableByteBuf rowBuf,
                                     MutableInt fieldLength)
                              throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to boolean.
        Specified by:
        decodeBoolean in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to boolean value
      • decodeDate

        public java.sql.Date decodeDate​(ColumnDecoder[] metadataList,
                                        MutableInt fieldIndex,
                                        StandardReadableByteBuf rowBuf,
                                        MutableInt fieldLength,
                                        java.util.Calendar cal,
                                        Context context)
                                 throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to Date.
        Specified by:
        decodeDate in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        cal - calendar
        context - current context
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to Date value
      • decodeTime

        public java.sql.Time decodeTime​(ColumnDecoder[] metadataList,
                                        MutableInt fieldIndex,
                                        StandardReadableByteBuf rowBuf,
                                        MutableInt fieldLength,
                                        java.util.Calendar cal,
                                        Context context)
                                 throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to Time.
        Specified by:
        decodeTime in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        cal - calendar
        context - connection context
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to Time value
      • decodeTimestamp

        public java.sql.Timestamp decodeTimestamp​(ColumnDecoder[] metadataList,
                                                  MutableInt fieldIndex,
                                                  StandardReadableByteBuf rowBuf,
                                                  MutableInt fieldLength,
                                                  java.util.Calendar cal,
                                                  Context context)
                                           throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to Timestamp.
        Specified by:
        decodeTimestamp in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        cal - calendar
        context - connection context
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to Timestamp value
      • decodeShort

        public short decodeShort​(ColumnDecoder[] metadataList,
                                 MutableInt fieldIndex,
                                 StandardReadableByteBuf rowBuf,
                                 MutableInt fieldLength)
                          throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to short.
        Specified by:
        decodeShort in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to short value
      • decodeInt

        public int decodeInt​(ColumnDecoder[] metadataList,
                             MutableInt fieldIndex,
                             StandardReadableByteBuf rowBuf,
                             MutableInt fieldLength)
                      throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to int.
        Specified by:
        decodeInt in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to int value
      • decodeLong

        public long decodeLong​(ColumnDecoder[] metadataList,
                               MutableInt fieldIndex,
                               StandardReadableByteBuf rowBuf,
                               MutableInt fieldLength)
                        throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to long.
        Specified by:
        decodeLong in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to long value
      • decodeFloat

        public float decodeFloat​(ColumnDecoder[] metadataList,
                                 MutableInt fieldIndex,
                                 StandardReadableByteBuf rowBuf,
                                 MutableInt fieldLength)
                          throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to float.
        Specified by:
        decodeFloat in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to float value
      • decodeDouble

        public double decodeDouble​(ColumnDecoder[] metadataList,
                                   MutableInt fieldIndex,
                                   StandardReadableByteBuf rowBuf,
                                   MutableInt fieldLength)
                            throws java.sql.SQLException
        Description copied from interface: RowDecoder
        Decode data according to double.
        Specified by:
        decodeDouble in interface RowDecoder
        Parameters:
        metadataList - metadata list
        fieldIndex - field index
        rowBuf - row buffer
        fieldLength - field length
        Returns:
        data
        Throws:
        java.sql.SQLException - if data type cannot be decoded to double value
      • wasNull

        public boolean wasNull​(byte[] nullBitmap,
                               MutableInt fieldIndex,
                               MutableInt fieldLength)
        Description copied from interface: RowDecoder
        Indicate if last decoded value was null
        Specified by:
        wasNull in interface RowDecoder
        Parameters:
        nullBitmap - null bitmap
        fieldIndex - field index
        fieldLength - field length
        Returns:
        true if last value was null
      • setPosition

        public int setPosition​(int newIndex,
                               MutableInt fieldIndex,
                               int maxIndex,
                               StandardReadableByteBuf rowBuf,
                               byte[] nullBitmap,
                               ColumnDecoder[] metadataList)
        Set length and pos indicator to asked index.
        Specified by:
        setPosition in interface RowDecoder
        Parameters:
        newIndex - index (1 is first).
        fieldIndex - current field index
        maxIndex - maximum index
        rowBuf - row buffer
        nullBitmap - null bitmap
        metadataList - metadata list
        Returns:
        new index to read data