Interface JDBCDecoder

  • All Known Implementing Classes:
    JDBCDecoderImpl

    public interface JDBCDecoder
    Represents for JDBC decoder from SQL value to Java value

    The default decoder provides the best efforts to convert SQL type to standard Java type as JDBC 4.2 spec.

    You can replace it to adapt to a specific SQL driver by creating your owns then includes in the SPI file ( META-INF/services/io.vertx.ext.jdbc.spi.JDBCDecoder)

    Since:
    4.2.0
    See Also:
    Mapping of java.sql.Types to SQL types, JDBCDecoderImpl, JDBCType, SQLType
    • Method Detail

      • decode

        Object decode​(io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor,
                      io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider)
               throws SQLException
        Convert the SQL value to Java value based on jdbc type
        Parameters:
        descriptor - the JDBC column descriptor
        valueProvider - the value provider
        Returns:
        java value
        Throws:
        SQLException
        Since:
        4.2.2
        See Also:
        SQLValueProvider, JDBCColumnDescriptor
      • cast

        Object cast​(Object value)
             throws SQLException
        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

        Parameters:
        value - value
        Returns:
        a presenter value
        Throws:
        SQLException - if any error when casting