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:
  • Method Summary

    Modifier and Type
    Method
    Description
    cast(Object value)
    Try cast SQL value to standard Java value depends on standard JDBC 4.2 type mapping and compatible with Vertx
    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
    parse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup)
    Parse SQL value to Java value
    parse(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup)
    Parse SQL value to Java value
  • Method Details

    • parse

      Object parse(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException
      Parse SQL value to Java value
      Parameters:
      rs - JDBC result set
      pos - the Database column position
      jdbcTypeLookup - JDBCType provider
      Returns:
      java value
      Throws:
      SQLException - if any error in parsing
      Since:
      4.2.2
      See Also:
    • parse

      Object parse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException
      Parse SQL value to Java value
      Parameters:
      cs - JDBC callable statement
      pos - the parameter column position
      jdbcTypeLookup - JDBCType provider
      Returns:
      java value
      Throws:
      SQLException - if any error in parsing
      Since:
      4.2.2
      See Also:
    • 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