public abstract class SQLStatement<SelfType extends SQLStatement<SelfType>> extends Object
Query
and
Update
. It defines most of the argument binding functions
used by its subclasses.Modifier and Type | Method and Description |
---|---|
protected void |
addCleanable(Cleanable cleanable) |
protected void |
addCustomizer(StatementCustomizer customizer) |
protected void |
addCustomizers(Collection<StatementCustomizer> customizers) |
SelfType |
addStatementCustomizer(StatementCustomizer customizer)
Provides a means for custom statement modification.
|
protected void |
afterExecution(PreparedStatement stmt) |
protected void |
beforeExecution(PreparedStatement stmt) |
SelfType |
bind(int position,
Argument argument)
Used if you need to have some exotic parameter bound.
|
SelfType |
bind(int position,
BigDecimal value)
Bind an argument positionally
|
SelfType |
bind(int position,
Blob value)
Bind an argument positionally
|
SelfType |
bind(int position,
boolean value)
Bind an argument positionally
|
SelfType |
bind(int position,
Boolean value)
Bind an argument positionally
|
SelfType |
bind(int position,
byte value)
Bind an argument positionally
|
SelfType |
bind(int position,
Byte value)
Bind an argument positionally
|
SelfType |
bind(int position,
byte[] value)
Bind an argument positionally
|
SelfType |
bind(int position,
char value)
Bind an argument positionally
|
SelfType |
bind(int position,
Character value)
Bind an argument positionally
|
SelfType |
bind(int position,
Clob value)
Bind an argument positionally
|
SelfType |
bind(int position,
Date value)
Bind an argument positionally
|
SelfType |
bind(int position,
Date value)
Bind an argument positionally
|
SelfType |
bind(int position,
double value)
Bind an argument positionally
|
SelfType |
bind(int position,
Double value)
Bind an argument positionally
|
SelfType |
bind(int position,
float value)
Bind an argument positionally
|
SelfType |
bind(int position,
Float value)
Bind an argument positionally
|
SelfType |
bind(int position,
int value)
Bind an argument positionally
|
SelfType |
bind(int position,
Integer value)
Bind an argument positionally
|
SelfType |
bind(int position,
long value)
Bind an argument positionally
|
SelfType |
bind(int position,
Long value)
Bind an argument positionally
|
SelfType |
bind(int position,
Object value)
Bind an argument positionally
|
SelfType |
bind(int position,
Reader value,
int length)
Bind an argument positionally
|
SelfType |
bind(int position,
short value)
Bind an argument positionally
|
SelfType |
bind(int position,
Short value)
Bind an argument positionally
|
SelfType |
bind(int position,
String value)
Bind an argument positionally
|
SelfType |
bind(int position,
Time value)
Bind an argument positionally
|
SelfType |
bind(int position,
Timestamp value)
Bind an argument positionally
|
SelfType |
bind(int position,
URL value)
Bind an argument positionally
|
SelfType |
bind(String name,
Argument argument)
Used if you need to have some exotic parameter bound.
|
SelfType |
bind(String name,
BigDecimal value)
Bind an argument by name
|
SelfType |
bind(String name,
Blob value)
Bind an argument by name
|
SelfType |
bind(String name,
boolean value)
Bind an argument by name
|
SelfType |
bind(String name,
Boolean value)
Bind an argument by name
|
SelfType |
bind(String name,
byte value)
Bind an argument by name
|
SelfType |
bind(String name,
Byte value)
Bind an argument by name
|
SelfType |
bind(String name,
byte[] value)
Bind an argument by name
|
SelfType |
bind(String name,
char value)
Bind an argument by name
|
SelfType |
bind(String name,
Character value)
Bind an argument by name
|
SelfType |
bind(String name,
Clob value)
Bind an argument by name
|
SelfType |
bind(String name,
Date value)
Bind an argument by name
|
SelfType |
bind(String name,
Date value)
Bind an argument by name
|
SelfType |
bind(String name,
double value)
Bind an argument by name
|
SelfType |
bind(String name,
Double value)
Bind an argument by name
|
SelfType |
bind(String name,
float value)
Bind an argument by name
|
SelfType |
bind(String name,
Float value)
Bind an argument by name
|
SelfType |
bind(String name,
int value)
Bind an argument by name
|
SelfType |
bind(String name,
Integer value)
Bind an argument by name
|
SelfType |
bind(String name,
long value)
Bind an argument by name
|
SelfType |
bind(String name,
Long value)
Bind an argument by name
|
SelfType |
bind(String name,
Object value)
Bind an argument by name
|
SelfType |
bind(String name,
Reader value,
int length)
Bind an argument by name
|
SelfType |
bind(String name,
short value)
Bind an argument by name
|
SelfType |
bind(String name,
Short value)
Bind an argument by name
|
SelfType |
bind(String name,
String value)
Bind an argument by name
|
SelfType |
bind(String name,
Time value)
Bind an argument by name
|
SelfType |
bind(String name,
Timestamp value)
Bind an argument by name
|
SelfType |
bind(String name,
URL value)
Bind an argument by name
|
SelfType |
bindASCIIStream(int position,
InputStream value,
int length)
Bind an argument positionally
|
SelfType |
bindASCIIStream(String name,
InputStream value,
int length)
Bind an argument by name
|
SelfType |
bindAsInt(int position,
boolean value)
Bind an argument positionally
|
SelfType |
bindAsInt(int position,
Boolean value)
Bind an argument positionally
|
SelfType |
bindAsInt(String name,
boolean value)
Bind an argument by name
|
SelfType |
bindAsInt(String name,
Boolean value)
Bind an argument by name
|
SelfType |
bindBinaryStream(int position,
InputStream value,
int length)
Bind an argument positionally
|
SelfType |
bindBinaryStream(String name,
InputStream value,
int length)
Bind an argument by name
|
SelfType |
bindBySqlType(int position,
Object value,
int sqlType)
Bind a value using a specific type from
java.sql.Types via
PreparedStatement#setObject(int, Object, int) |
SelfType |
bindBySqlType(String name,
Object value,
int sqlType)
Bind a value using a specific type from
java.sql.Types via
PreparedStatement#setObject(int, Object, int) |
SelfType |
bindFromMap(Map<String,? extends Object> args)
Binds named parameters from a map of String to Object instances
|
SelfType |
bindFromProperties(Object o)
Binds named parameters from JavaBean properties on o.
|
SelfType |
bindNamedArgumentFinder(NamedArgumentFinder namedArgumentFinder)
Binds a new
NamedArgumentFinder . |
SelfType |
bindNull(int position,
int sqlType)
Bind NULL to be set for a given argument.
|
SelfType |
bindNull(String name,
int sqlType)
Bind NULL to be set for a given argument.
|
protected void |
cleanup() |
SelfType |
cleanupHandle()
Close the handle when the statement is closed.
|
SelfType |
cleanupHandle(TransactionState state)
Force transaction state when the statement is cleaned up.
|
SelfType |
clearBindings() |
SelfType |
define(Map<String,? extends Object> values)
Adds all key/value pairs in the Map to the
StatementContext . |
SelfType |
define(String key,
Object value)
Define a value on the
StatementContext . |
SelfType |
dynamicBind(Class<?> argumentClass,
String name,
Object value)
Bind an argument dynamically by the class passed in.
|
protected ConcreteStatementContext |
getConcreteContext() |
protected org.skife.jdbi.v2.ContainerFactoryRegistry |
getContainerMapperRegistry() |
StatementContext |
getContext()
Obtain the statement context associated with this statement
|
protected Foreman |
getForeman() |
protected Handle |
getHandle() |
protected SQLLog |
getLog() |
protected Binding |
getParams() |
protected StatementRewriter |
getRewriter() |
protected String |
getSql()
The un-translated SQL used to create this statement
|
protected StatementBuilder |
getStatementBuilder() |
protected Collection<StatementCustomizer> |
getStatementCustomizers() |
protected StatementLocator |
getStatementLocator() |
protected TimingCollector |
getTimingCollector() |
protected <Result> Result |
internalExecute(org.skife.jdbi.v2.QueryResultMunger<Result> munger) |
SelfType |
registerArgumentFactory(ArgumentFactory<?> argumentFactory) |
SelfType |
registerContainerFactory(ContainerFactory<?> containerFactory) |
void |
setFetchDirection(int value) |
SelfType |
setFetchDirection2(int value) |
SelfType |
setQueryTimeout(int seconds)
Set the query timeout, in seconds, on the prepared statement
|
void |
setStatementLocator(StatementLocator locator)
Override the statement locator used for this statement
|
SelfType |
setStatementLocator2(StatementLocator locator)
Exactly the same as setStatementLocator but returns self.
|
void |
setStatementRewriter(StatementRewriter rewriter)
Override the statement rewriter used for this statement
|
SelfType |
setStatementRewriter2(StatementRewriter rewriter)
Exactly the same as setStatementRewriter but returns self
|
public SelfType addStatementCustomizer(StatementCustomizer customizer)
Query.setMaxRows(int)
customizer
- instance to be used to cstomize a statementpublic SelfType bind(int position, Argument argument)
position
- position to bindBinaryStream this argument, starting at 0argument
- exotic argument factorypublic final SelfType bind(int position, BigDecimal value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Blob value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, boolean value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Boolean value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, byte value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Byte value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, byte[] value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, char value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Character value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Clob value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Date value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Date value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, double value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Double value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, float value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Float value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, int value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Integer value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, long value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Long value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Object value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Reader value, int length)
position
- position to bind the paramater at, starting at 0value
- to bindlength
- number of characters to readpublic final SelfType bind(int position, short value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Short value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, String value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Time value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, Timestamp value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bind(int position, URL value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic SelfType bind(String name, Argument argument)
name
- name to bindBinaryStream this argumentargument
- exotic argument factorypublic final SelfType bind(String name, BigDecimal value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Blob value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, boolean value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Boolean value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, byte value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Byte value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, byte[] value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, char value)
name
- name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Character value)
name
- token name to bind the parameter tovalue
- to bindpublic final SelfType bind(String name, Clob value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Date value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Date value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, double value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Double value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, float value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Float value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, int value)
name
- name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Integer value)
name
- name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, long value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Long value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Object value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Reader value, int length)
name
- token name to bind the paramater tovalue
- to bindlength
- number of characters to readpublic final SelfType bind(String name, short value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Short value)
name
- token name to bind the paramater tovalue
- to bindpublic SelfType bind(String name, String value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Time value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, Timestamp value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bind(String name, URL value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bindASCIIStream(int position, InputStream value, int length)
position
- position to bind the paramater at, starting at 0value
- to bindlength
- how long is the stream being bound?public final SelfType bindASCIIStream(String name, InputStream value, int length)
name
- token name to bind the paramater tovalue
- to bindlength
- bytes to read from valuepublic final SelfType bindAsInt(int position, boolean value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bindAsInt(int position, Boolean value)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bindAsInt(String name, boolean value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bindAsInt(String name, Boolean value)
name
- token name to bind the paramater tovalue
- to bindpublic final SelfType bindBinaryStream(int position, InputStream value, int length)
position
- position to bind the paramater at, starting at 0value
- to bindpublic final SelfType bindBinaryStream(String name, InputStream value, int length)
name
- token name to bind the paramater tovalue
- to bindlength
- bytes to read from valuepublic final SelfType bindBySqlType(int position, Object value, int sqlType)
java.sql.Types
via
PreparedStatement#setObject(int, Object, int)position
- position to bind NULL to, starting at 0value
- Value to bindsqlType
- The sqlType from java.sql.Typespublic final SelfType bindBySqlType(String name, Object value, int sqlType)
java.sql.Types
via
PreparedStatement#setObject(int, Object, int)name
- Named parameter to bind atvalue
- Value to bindsqlType
- The sqlType from java.sql.Typespublic SelfType bindFromMap(Map<String,? extends Object> args)
args
- map where keys are matched to named parameters in order to bind arguments.
Can be null, in this case, the binding has no effect.public SelfType bindFromProperties(Object o)
o
- source of named parameter values to use as argumentspublic SelfType bindNamedArgumentFinder(NamedArgumentFinder namedArgumentFinder)
NamedArgumentFinder
.namedArgumentFinder
- A NamedArgumentFinder to bind. Can be null.public final SelfType bindNull(int position, int sqlType)
position
- position to bind NULL to, starting at 0sqlType
- The sqlType must be set and is a value from java.sql.Types
public final SelfType bindNull(String name, int sqlType)
name
- Named parameter to bind tosqlType
- The sqlType must be set and is a value from java.sql.Types
public SelfType cleanupHandle()
public SelfType cleanupHandle(TransactionState state)
public SelfType clearBindings()
public SelfType define(Map<String,? extends Object> values)
StatementContext
.values
- containing key/value pairs.public SelfType define(String key, Object value)
StatementContext
.key
- Key to access this value from the StatementContextvalue
- Value to setAttribute on the StatementContextpublic final SelfType dynamicBind(Class<?> argumentClass, String name, Object value)
name
- token name to bind the paramater tovalue
- to bindprotected org.skife.jdbi.v2.ContainerFactoryRegistry getContainerMapperRegistry()
protected Handle getHandle()
protected SQLLog getLog()
protected Binding getParams()
protected StatementRewriter getRewriter()
protected String getSql()
protected StatementBuilder getStatementBuilder()
protected StatementLocator getStatementLocator()
protected TimingCollector getTimingCollector()
protected <Result> Result internalExecute(org.skife.jdbi.v2.QueryResultMunger<Result> munger)
public SelfType registerArgumentFactory(ArgumentFactory<?> argumentFactory)
public SelfType registerContainerFactory(ContainerFactory<?> containerFactory)
public void setFetchDirection(int value)
public SelfType setFetchDirection2(int value)
public SelfType setQueryTimeout(int seconds)
seconds
- number of seconds before timing outpublic void setStatementLocator(StatementLocator locator)
public SelfType setStatementLocator2(StatementLocator locator)
public void setStatementRewriter(StatementRewriter rewriter)
public SelfType setStatementRewriter2(StatementRewriter rewriter)
protected void addCleanable(Cleanable cleanable)
protected void addCustomizer(StatementCustomizer customizer)
protected void addCustomizers(Collection<StatementCustomizer> customizers)
protected final void afterExecution(PreparedStatement stmt)
protected final void beforeExecution(PreparedStatement stmt)
protected final void cleanup()
protected final ConcreteStatementContext getConcreteContext()
public final StatementContext getContext()
protected final Foreman getForeman()
protected Collection<StatementCustomizer> getStatementCustomizers()
Copyright © 2018. All rights reserved.