public interface ValueAccessor
getJdbcType() indicates the JDBC type handled by the implementation.
Manifold provides default implementations that are suitable for most use-cases.
This interface performs the following:Types| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOGGER |
| Modifier and Type | Method and Description |
|---|---|
default java.lang.Class<?> |
getClassForColumnClassName(java.lang.String className,
java.lang.Class<?> defaultClass)
Use column class name
|
java.lang.Class<?> |
getJavaType(BaseElement elem) |
int |
getJdbcType() |
default java.lang.String |
getParameterExpression(java.sql.DatabaseMetaData metaData,
java.lang.Object value,
ColumnInfo ci)
Supply a parameter expression.
|
java.lang.Object |
getRowValue(java.sql.ResultSet rs,
BaseElement elem)
Returns a query result value corresponding with a
elem from rs. |
void |
setParameter(java.sql.PreparedStatement ps,
int pos,
java.lang.Object value)
Sets the query parameter value corresponding with
pos. |
int getJdbcType()
Types id this accessor handles.java.lang.Class<?> getJavaType(BaseElement elem)
java.sql.Types#CLOB maps to java.sql.CLOB (appendix
table B.3 from the JDBC 4.2 specification) the actual type generated for CLOB is String.java.lang.Object getRowValue(java.sql.ResultSet rs,
BaseElement elem)
throws java.sql.SQLException
elem from rs.rs - The result set containing rows of column valueselem - The query column from which to find a valueelem. Note, the type of the value must match the Java type returned from
elem.getType().java.sql.SQLExceptionvoid setParameter(java.sql.PreparedStatement ps,
int pos,
java.lang.Object value)
throws java.sql.SQLException
pos.ps - The prepared statement containing the parameterized query.pos - The index of the parameter, beginning with 1.value - The value of the parameterjava.sql.SQLExceptiondefault java.lang.String getParameterExpression(java.sql.DatabaseMetaData metaData,
java.lang.Object value,
ColumnInfo ci)
?, however some JDBC drivers and database systems
require explicit casts when using certain data types. For instance, Postgres requires casts for several types e.g.,
Boolean to bit; there is no other way to get a value from Java into a Postgres bit column.default java.lang.Class<?> getClassForColumnClassName(java.lang.String className,
java.lang.Class<?> defaultClass)
Copyright © 2023. All rights reserved.