public class DateAsTimestampBinding extends java.lang.Object implements Binding<java.sql.Timestamp,java.sql.Timestamp>
Constructor and Description |
---|
DateAsTimestampBinding() |
Modifier and Type | Method and Description |
---|---|
Converter<java.sql.Timestamp,java.sql.Timestamp> |
converter()
A converter that can convert between the database type and the custom
type.
|
void |
get(BindingGetResultSetContext<java.sql.Timestamp> ctx)
Get a
ResultSet 's OUT value. |
void |
get(BindingGetSQLInputContext<java.sql.Timestamp> ctx)
Get a
SQLInput 's OUT value. |
void |
get(BindingGetStatementContext<java.sql.Timestamp> ctx)
Get a
CallableStatement 's OUT value. |
void |
register(BindingRegisterContext<java.sql.Timestamp> ctx)
Register a
CallableStatement 's OUT parameter. |
void |
set(BindingSetSQLOutputContext<java.sql.Timestamp> ctx)
Set a
SQLOutput 's IN parameter. |
void |
set(BindingSetStatementContext<java.sql.Timestamp> ctx)
Set a
PreparedStatement 's IN parameter. |
void |
sql(BindingSQLContext<java.sql.Timestamp> ctx)
Generate SQL code for the bind variable.
|
public final Converter<java.sql.Timestamp,java.sql.Timestamp> converter()
Binding
public final void sql(BindingSQLContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
Implementations should generate SQL code onto
BindingSQLContext.render()
, given the context's bind variable
located at BindingSQLContext.value()
. Examples of such SQL code
are:
"?"
: Default implementations can simply generate a
question mark."123"
: Implementations may choose to inline bind
variables to influence execution plan generation.RenderContext.paramType()
contains information whether inlined
bind variables are expected in the current context."CAST(? AS DATE)"
: Cast a database to a more specific
type. This can be useful in databases like Oracle, which map both
DATE
and TIMESTAMP
SQL types to
Timestamp
.RenderContext.castMode()
may contain some hints about whether
casting is suggested in the current context."?::json"
: Vendor-specific bind variables can be
supported, e.g. SQLDialect.POSTGRES
's JSON data type.
Implementations must provide consistent behaviour between
Binding.sql(BindingSQLContext)
and
Binding.set(BindingSetStatementContext)
, i.e. when bind variables are
inlined, then they must not be bound to the PreparedStatement
in
Binding.set(BindingSetStatementContext)
sql
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void register(BindingRegisterContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
CallableStatement
's OUT
parameter.register
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void set(BindingSetStatementContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
PreparedStatement
's IN
parameter.set
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void set(BindingSetSQLOutputContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
SQLOutput
's IN
parameter.set
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void get(BindingGetResultSetContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
ResultSet
's OUT
value.
Implementations are expected to produce a value by calling
BindingGetResultSetContext.value(Object)
, passing the resulting
value to the method.
get
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void get(BindingGetStatementContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
CallableStatement
's OUT
value.
Implementations are expected to produce a value by calling
BindingGetStatementContext.value(Object)
, passing the resulting
value to the method.
get
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.public final void get(BindingGetSQLInputContext<java.sql.Timestamp> ctx) throws java.sql.SQLException
Binding
SQLInput
's OUT
value.
Implementations are expected to produce a value by calling
BindingGetSQLInputContext.value(Object)
, passing the resulting
value to the method.
get
in interface Binding<java.sql.Timestamp,java.sql.Timestamp>
ctx
- The context object containing all argument objects.java.sql.SQLException
- Implementations are allowed to pass on all
SQLException
s to the caller to be wrapped in
DataAccessException
s.Copyright © 2018. All Rights Reserved.