- All Implemented Interfaces:
Serializable
,Binding<T,
U>
- Author:
- Lukas Eder
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Constructor Summary
ConstructorDescriptionDefaultBinding
(Binding<T, U> delegate) DefaultBinding
(Converter<T, U> converter) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic final <T,
U> Binding<T, U> Get the internal default binding for aConverter
.static final <T> Binding<T,
T> Get the internal default binding for aDataType
.A converter that can convert between the database type and the custom type.void
get
(BindingGetResultSetContext<U> ctx) Get aResultSet
'sOUT
value.void
get
(BindingGetSQLInputContext<U> ctx) Get aSQLInput
'sOUT
value.void
get
(BindingGetStatementContext<U> ctx) Get aCallableStatement
'sOUT
value.void
register
(BindingRegisterContext<U> ctx) Register aCallableStatement
'sOUT
parameter.void
set
(BindingSetSQLOutputContext<U> ctx) Set aSQLOutput
'sIN
parameter.void
set
(BindingSetStatementContext<U> ctx) Set aPreparedStatement
'sIN
parameter.void
sql
(BindingSQLContext<U> ctx) Generate SQL code for the bind variable.toString()
-
Constructor Details
-
DefaultBinding
Deprecated, for removal: This API element is subject to removal in a future version.- 3.11 - [#6631] - Usebinding(Converter)
instead. -
DefaultBinding
-
-
Method Details
-
binding
Get the internal default binding for aConverter
. -
binding
Get the internal default binding for aDataType
. -
converter
Description copied from interface:Binding
A converter that can convert between the database type and the custom type.While the
Converter
property of a binding is not optional (Converter.fromType()
andConverter.toType()
are needed by jOOQ's internals), the conversion implementation (i.e.Converter.from(Object)
andConverter.to(Object)
) isn't strictly required if implementations don't rely on it. -
sql
Description copied from interface:Binding
Generate SQL code for the bind variable.Implementations should generate SQL code onto
BindingSQLContext.render()
, given the context's bind variable located atBindingSQLContext.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.
Context.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 bothDATE
andTIMESTAMP
SQL types toTimestamp
.
Context.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)
andBinding.set(BindingSetStatementContext)
, i.e. when bind variables are inlined, then they must not be bound to thePreparedStatement
inBinding.set(BindingSetStatementContext)
- Specified by:
sql
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
register
Description copied from interface:Binding
Register aCallableStatement
'sOUT
parameter.- Specified by:
register
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
set
Description copied from interface:Binding
Set aPreparedStatement
'sIN
parameter.- Specified by:
set
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
set
Description copied from interface:Binding
Set aSQLOutput
'sIN
parameter.- Specified by:
set
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
Description copied from interface:Binding
Get aResultSet
'sOUT
value.Implementations are expected to produce a value by calling
BindingGetResultSetContext.value(Object)
, passing the resulting value to the method.- Specified by:
get
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
Description copied from interface:Binding
Get aCallableStatement
'sOUT
value.Implementations are expected to produce a value by calling
BindingGetStatementContext.value(Object)
, passing the resulting value to the method.- Specified by:
get
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
Description copied from interface:Binding
Get aSQLInput
'sOUT
value.Implementations are expected to produce a value by calling
BindingGetSQLInputContext.value(Object)
, passing the resulting value to the method.- Specified by:
get
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
toString
-
binding(Converter)
instead.