Class JDBCDecoderImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      JDBCDecoderImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object cast​(Object value)
      Try cast SQL value to standard Java value depends on standard JDBC 4.2 type mapping and compatible with Vertx
      Object decode​(io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor, io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider)
      Convert the SQL value to Java value based on jdbc type
      protected Object decodeArray​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)  
      protected Object decodeArray​(Array value, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor baseType)  
      protected Object decodeBinary​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from JDBCTypeWrapper.isBinaryType() datatype to Buffer.
      protected Object decodeDateTime​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from date time JDBCType to Java date time
      protected Object decodeLink​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from JDBCType.DATALINK datatype to URL
      protected Object decodeNumber​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from Number JDBCType to Number
      protected Object decodeSpecificVendorType​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from the specific SQL vendor data type to Java value
      protected Object decodeStruct​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from JDBCType.STRUCT datatype to Tuple
      protected Object decodeUnhandledType​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from the unhandled data type
      protected Object decodeXML​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
      Convert a value from JDBCType.SQLXML datatype to Buffer
      protected Object getCoerceObject​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, Class<?> cls)  
      Object parse​(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup)
      Parse SQL value to Java value
      Object parse​(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup)
      Parse SQL value to Java value
      protected Buffer streamToBuffer​(InputStream is, Class<?> dataTypeClass)  
    • Constructor Detail

      • JDBCDecoderImpl

        public JDBCDecoderImpl()
    • Method Detail

      • decode

        public Object decode​(io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor,
                             io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider)
                      throws SQLException
        Description copied from interface: JDBCDecoder
        Convert the SQL value to Java value based on jdbc type
        Specified by:
        decode in interface JDBCDecoder
        Parameters:
        descriptor - the JDBC column descriptor
        valueProvider - the value provider
        Returns:
        java value
        Throws:
        SQLException
        See Also:
        SQLValueProvider, JDBCColumnDescriptor
      • cast

        public Object cast​(Object value)
                    throws SQLException
        Description copied from interface: JDBCDecoder
        Try cast SQL value to standard Java value depends on standard JDBC 4.2 type mapping and compatible with Vertx

        For example: - java.sql.Time -> java.time.LocalTime - java.sql.Timestamp -> java.time.LocalDateTime

        Specified by:
        cast in interface JDBCDecoder
        Parameters:
        value - value
        Returns:
        a presenter value
        Throws:
        SQLException - if any error when casting
      • decodeArray

        protected Object decodeArray​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                     io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                              throws SQLException
        Throws:
        SQLException
      • decodeDateTime

        protected Object decodeDateTime​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                        io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                                 throws SQLException
        Convert a value from date time JDBCType to Java date time
        Throws:
        SQLException
        See Also:
        JDBCTypeWrapper.isDateTimeType()
      • decodeNumber

        protected Object decodeNumber​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                      io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                               throws SQLException
        Convert a value from Number JDBCType to Number
        Throws:
        SQLException
        See Also:
        JDBCTypeWrapper.isNumberType()
      • decodeBinary

        protected Object decodeBinary​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                      io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                               throws SQLException
        Convert a value from JDBCTypeWrapper.isBinaryType() datatype to Buffer.

        Keep value as it is if the actual value's type is not byte[]

        Throws:
        SQLException
        See Also:
        JDBCTypeWrapper.isBinaryType()
      • decodeLink

        protected Object decodeLink​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                    io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                             throws SQLException
        Convert a value from JDBCType.DATALINK datatype to URL

        Keep value as it is if the actual value's type is not URL or String

        Throws:
        SQLException
      • decodeUnhandledType

        protected Object decodeUnhandledType​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                             io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                                      throws SQLException
        Convert a value from the unhandled data type

        The default implementation converts any data type to a string value

        Returns:
        value
        Throws:
        SQLException
        See Also:
        JDBCTypeWrapper.isUnhandledType()
      • decodeSpecificVendorType

        protected Object decodeSpecificVendorType​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                                  io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor)
                                           throws SQLException
        Convert a value from the specific SQL vendor data type to Java value

        The default implementation converts any data type to a string value

        Returns:
        value
        Throws:
        SQLException
        See Also:
        JDBCTypeWrapper.isSpecificVendorType()
      • getCoerceObject

        protected Object getCoerceObject​(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider,
                                         Class<?> cls)
                                  throws SQLException
        Throws:
        SQLException