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 TypeMethodDescriptionTry cast SQL value to standard Java value depends on standard JDBC 4.2 type mapping and compatible with Vertxdecode(io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor, io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider) Convert the SQL value to Java value based on jdbc typeparse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) Parse SQL value to Java valueparse(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 setpos- the Database column positionjdbcTypeLookup- 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 statementpos- the parameter column positionjdbcTypeLookup- 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 descriptorvalueProvider- the value provider- Returns:
- java value
- Throws:
SQLException- Since:
- 4.2.2
- See Also:
-
cast
Try cast SQL value to standard Java value depends on standard JDBC 4.2 type mapping and compatible with VertxFor 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
-