public abstract class StatementBase extends Object implements Statement
Connection.getAutoCommit() is true/code>,
the connection will be automatically closed. If you want to prevent this,
you can use the disableCloseConnection parameter... You
can then reuse the connection, but it's up to you to close it when you're
done.
Some code based on :
| Constructor and Description |
|---|
StatementBase(Connection connection,
QueryResultFactory queryResultFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCurrentParamsToStatement(PreparedStatement statement) |
void |
addParam(String paramName,
Object value) |
protected void |
addParamsToStatement(PreparedStatement statement,
Map<String,Object> params) |
protected void |
clearParams() |
void |
clearSql()
Clears the current SQL query being built.
|
void |
clearSql(boolean keepCurrentBoundParams)
Clears the current SQL query being built.
|
protected void |
close(PreparedStatement statement)
Closes statement quietly
|
protected void |
close(ResultSet resultSet)
Closes resultSet quietly
|
protected Connection |
getConnection() |
protected Map<String,Set<Integer>> |
getIndexMap() |
protected String |
getOriginalQuery() |
protected Map<String,Object> |
getParams() |
protected String |
getParsedQuery() |
protected StringBuilder |
getQueryBuilder() |
protected QueryResultFactory |
getQueryResultFactory() |
String |
getSql(boolean friendly)
Returns the current SQL query.
|
protected BasicFormatterImpl |
getSqlFormmatter() |
Map<String,String> |
getStaticTokens() |
protected String |
parse() |
void |
setBoolean(String paramName,
Boolean value) |
void |
setDate(String paramName,
LocalDate value) |
void |
setDouble(String paramName,
Double value) |
void |
setFloat(String paramName,
Float value) |
void |
setInInteger(String paramName,
Set<Integer> items)
Explodes a collection of Integer and replaces the specified param with them,
so it can be used inside a
IN(:ids) section
|
void |
setInLong(String paramName,
Set<Long> items)
Explodes a collection of Long and replaces the specified param with them,
so it can be used inside a
IN(:ids) section
|
void |
setInstant(String paramName,
Instant value)
This replaces setTimestamp()!
|
void |
setInString(String paramName,
Set<String> items)
Explodes a collection of String and replaces the specified param with them,
so it can be used inside a
IN(:ids) section
|
void |
setInteger(String paramName,
Integer value) |
void |
setLong(String paramName,
Long value) |
void |
setString(String paramName,
String value) |
void |
sql(String sql)
Appends some SQL to the query to launch.
|
String |
toString() |
public StatementBase(Connection connection, QueryResultFactory queryResultFactory)
protected StringBuilder getQueryBuilder()
protected BasicFormatterImpl getSqlFormmatter()
public void sql(String sql)
StatementStatement.clearSql() first!public void clearSql()
Statementpublic void clearSql(boolean keepCurrentBoundParams)
Statementpublic String getSql(boolean friendly)
Statementprotected String getOriginalQuery()
protected String getParsedQuery()
protected String parse()
protected void clearParams()
protected QueryResultFactory getQueryResultFactory()
protected Connection getConnection()
protected void addCurrentParamsToStatement(PreparedStatement statement)
protected void addParamsToStatement(PreparedStatement statement, Map<String,Object> params)
protected void close(PreparedStatement statement)
protected void close(ResultSet resultSet)
public void setInstant(String paramName, Instant value)
StatementsetInstant in interface Statementpublic void setBoolean(String paramName, Boolean value)
setBoolean in interface Statementpublic void setInteger(String paramName, Integer value)
setInteger in interface Statementpublic void setInLong(String paramName, Set<Long> items)
Statementpublic void setInInteger(String paramName, Set<Integer> items)
StatementsetInInteger in interface Statementpublic void setInString(String paramName, Set<String> items)
StatementsetInString in interface StatementCopyright © 2017. All rights reserved.