Class JDBCDecoderImpl
java.lang.Object
io.vertx.jdbcclient.spi.JDBCDecoderImpl
- All Implemented Interfaces:
JDBCDecoder
-
Constructor Summary
Constructors -
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 typeprotected ObjectdecodeArray(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) protected ObjectdecodeArray(Array value, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor baseType) protected ObjectdecodeBinary(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value fromJDBCTypeWrapper.isBinaryType()datatype toBuffer.protected ObjectdecodeDateTime(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value from date time JDBCType to Java date timeprotected ObjectdecodeLink(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value fromJDBCType.DATALINKdatatype toURLprotected ObjectdecodeNumber(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value from Number JDBCType to Numberprotected ObjectdecodeSpecificVendorType(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value from thespecific SQL vendor data typetoJavavalueprotected ObjectdecodeStruct(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value fromJDBCType.STRUCTdatatype toTupleprotected ObjectdecodeUnhandledType(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value from the unhandled data typeprotected ObjectdecodeXML(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) Convert a value fromJDBCType.SQLXMLdatatype toBufferprotected ObjectgetCoerceObject(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, Class<?> cls) parse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) Parse SQL value to Java valueparse(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) Parse SQL value to Java valueprotected StringreaderToString(Reader reader, Class<?> dataTypeClass) protected BufferstreamToBuffer(InputStream is, Class<?> dataTypeClass)
-
Constructor Details
-
JDBCDecoderImpl
public JDBCDecoderImpl()
-
-
Method Details
-
parse
public Object parse(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException Description copied from interface:JDBCDecoderParse SQL value to Java value- Specified by:
parsein interfaceJDBCDecoder- Parameters:
rs- JDBC result setpos- the Database column positionjdbcTypeLookup- JDBCType provider- Returns:
- java value
- Throws:
SQLException- if any error in parsing- See Also:
-
parse
public Object parse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException Description copied from interface:JDBCDecoderParse SQL value to Java value- Specified by:
parsein interfaceJDBCDecoder- Parameters:
cs- JDBC callable statementpos- the parameter column positionjdbcTypeLookup- JDBCType provider- Returns:
- java value
- Throws:
SQLException- if any error in parsing- See Also:
-
decode
public Object decode(io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor, io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider) throws SQLException Description copied from interface:JDBCDecoderConvert the SQL value to Java value based on jdbc type- Specified by:
decodein interfaceJDBCDecoder- Parameters:
descriptor- the JDBC column descriptorvalueProvider- the value provider- Returns:
- java value
- Throws:
SQLException- See Also:
-
cast
Description copied from interface:JDBCDecoderTry 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
- Specified by:
castin interfaceJDBCDecoder- 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:
-
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:
-
decodeBinary
protected Object decodeBinary(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) throws SQLException Convert a value fromJDBCTypeWrapper.isBinaryType()datatype toBuffer.Keep value as it is if the actual value's type is not
byte[]- Throws:
SQLException- See Also:
-
decodeStruct
protected Object decodeStruct(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) throws SQLException Convert a value fromJDBCType.STRUCTdatatype toTupleFallback to
decodeUnhandledType(SQLValueProvider, JDBCColumnDescriptor)if the actual value's type is notStruct- Throws:
SQLException
-
decodeLink
protected Object decodeLink(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) throws SQLException Convert a value fromJDBCType.DATALINKdatatype toURLKeep value as it is if the actual value's type is not
URLorString- Throws:
SQLException
-
decodeXML
protected Object decodeXML(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) throws SQLException Convert a value fromJDBCType.SQLXMLdatatype toBufferFallback to
decodeUnhandledType(SQLValueProvider, JDBCColumnDescriptor)} if the actual value's type is notSQLXML- 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 typeThe default implementation converts any data type to a string value
- Returns:
- value
- Throws:
SQLException- See Also:
-
decodeSpecificVendorType
protected Object decodeSpecificVendorType(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor descriptor) throws SQLException Convert a value from thespecific SQL vendor data typetoJavavalueThe default implementation converts any data type to a string value
- Returns:
- value
- Throws:
SQLException- See Also:
-
decodeArray
protected Object decodeArray(Array value, io.vertx.jdbcclient.impl.actions.JDBCColumnDescriptor baseType) throws SQLException - Throws:
SQLException
-
getCoerceObject
protected Object getCoerceObject(io.vertx.jdbcclient.impl.actions.SQLValueProvider valueProvider, Class<?> cls) throws SQLException - Throws:
SQLException
-
streamToBuffer
- Throws:
SQLException
-
readerToString
- Throws:
SQLException
-