Package io.vertx.jdbcclient.spi

## 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 Summary

    All Methods Instance Methods Abstract 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
    `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

- - ### Method Detail

    - #### 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:
        `ResultSet`, `JDBCColumnDescriptorProvider`

    - #### 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:
        `CallableStatement`, `JDBCColumnDescriptorProvider`

    - #### 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