Class ClobBinding
- java.lang.Object
-
- org.jooq.impl.ClobBinding
-
- All Implemented Interfaces:
java.io.Serializable
,Binding<java.lang.String,java.lang.String>
public class ClobBinding extends java.lang.Object implements Binding<java.lang.String,java.lang.String>
A binding that takes binary values but binds them asClob
to at the JDBC level.This is useful for workarounds for bugs in Oracle, like ORA-01461: can bind a LONG value only for insert into a LONG column (see [#4091])
- Author:
- Lukas Eder
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClobBinding()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Converter<java.lang.String,java.lang.String>
converter()
A converter that can convert between the database type and the custom type.void
get(BindingGetResultSetContext<java.lang.String> ctx)
Get aResultSet
'sOUT
value.void
get(BindingGetSQLInputContext<java.lang.String> ctx)
Get aSQLInput
'sOUT
value.void
get(BindingGetStatementContext<java.lang.String> ctx)
Get aCallableStatement
'sOUT
value.void
register(BindingRegisterContext<java.lang.String> ctx)
Register aCallableStatement
'sOUT
parameter.void
set(BindingSetSQLOutputContext<java.lang.String> ctx)
Set aSQLOutput
'sIN
parameter.void
set(BindingSetStatementContext<java.lang.String> ctx)
Set aPreparedStatement
'sIN
parameter.void
sql(BindingSQLContext<java.lang.String> ctx)
Generate SQL code for the bind variable.
-
-
-
Method Detail
-
converter
public final Converter<java.lang.String,java.lang.String> converter()
Description copied from interface:Binding
A converter that can convert between the database type and the custom type.
-
sql
public final void sql(BindingSQLContext<java.lang.String> ctx) throws java.sql.SQLException
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.
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 bothDATE
andTIMESTAMP
SQL types toTimestamp
.
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)
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<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
register
public final void register(BindingRegisterContext<java.lang.String> ctx) throws java.sql.SQLException
Description copied from interface:Binding
Register aCallableStatement
'sOUT
parameter.- Specified by:
register
in interfaceBinding<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
set
public final void set(BindingSetStatementContext<java.lang.String> ctx) throws java.sql.SQLException
Description copied from interface:Binding
Set aPreparedStatement
'sIN
parameter.- Specified by:
set
in interfaceBinding<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
set
public final void set(BindingSetSQLOutputContext<java.lang.String> ctx) throws java.sql.SQLException
Description copied from interface:Binding
Set aSQLOutput
'sIN
parameter.- Specified by:
set
in interfaceBinding<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
public final void get(BindingGetResultSetContext<java.lang.String> ctx) throws java.sql.SQLException
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<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
public final void get(BindingGetStatementContext<java.lang.String> ctx) throws java.sql.SQLException
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<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
public final void get(BindingGetSQLInputContext<java.lang.String> ctx) throws java.sql.SQLException
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<java.lang.String,java.lang.String>
- Parameters:
ctx
- The context object containing all argument objects.- Throws:
java.sql.SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
-