Interface Statement
- All Known Subinterfaces:
BatchInsertStatement
,DeleteStatement
,InsertStatement
,SelectStatement
,UpdateStatement
- All Known Implementing Classes:
BatchInsertStatementDefault
,DeleteStatementDefault
,InsertStatementDefault
,SelectStatementDefault
,StatementBase
,UpdateStatementDefault
public interface Statement
Note that the connection used by a Stement is
not closed after the statement has
been executed.
Have a look at JdbcScope
to manage the
closing of connections properly.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearSql()
Clears the current SQL query being built.void
clearSql
(boolean keepCurrentBoundParams) Clears the current SQL query being built.getSql
(boolean friendly) Returns the current SQL query.void
setBoolean
(String paramName, Boolean value) void
void
void
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 <codeIN(:ids)</code sectionvoid
Explodes a collection of Long and replaces the specified param with them, so it can be used inside a <codeIN(:ids)</code sectionvoid
setInstant
(String string, Instant instant) 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 aIN(:ids)
section.void
setInStringFromEnumNames
(String paramName, Enum<?>... enumItems) Uses a list of enum names so it can be used inside aIN(:ids)
section.void
setInStringFromEnumNames
(String paramName, Set<? extends Enum<?>> enumItems) Explodes a collection of enum names and replaces the specified param with them, so it can be used inside aIN(:ids)
section.void
setInteger
(String paramName, Integer value) void
void
setLongList
(String paramName, List<Long> items) Explodes a list of Long and replaces the specified param with them, so it can be used to replace a "ids list" inside a (PostgreSQL example):INNER JOIN UNNEST('{:idsList}'::int[]) WITH ORDINALITY o(id, ord) ON o.id = myMainTable.id
void
void
Appends some SQL to the query to launch.
-
Method Details
-
sql
Appends some SQL to the query to launch. If you want to restart the query from scratch, you need to callclearSql()
first! -
clearSql
void clearSql()Clears the current SQL query being built. Also removes any bound parameters. -
clearSql
void clearSql(boolean keepCurrentBoundParams) Clears the current SQL query being built.- Parameters:
keepCurrentBoundParams
- iftrue
, the currently bound parameters won't be cleared, only the query.
-
getSql
Returns the current SQL query. -
setInstant
This replaces setTimestamp()! -
setDate
-
setBoolean
-
setString
-
setInteger
-
setLong
-
setFloat
-
setDouble
-
setInLong
Explodes a collection of Long and replaces the specified param with them, so it can be used inside a <codeIN(:ids)</code section -
setInInteger
Explodes a collection of Integer and replaces the specified param with them, so it can be used inside a <codeIN(:ids)</code section -
setInString
Explodes a collection of String and replaces the specified param with them, so it can be used inside aIN(:ids)
section. -
setInStringFromEnumNames
Explodes a collection of enum names and replaces the specified param with them, so it can be used inside aIN(:ids)
section. -
setInStringFromEnumNames
Uses a list of enum names so it can be used inside aIN(:ids)
section. -
setLongList
Explodes a list of Long and replaces the specified param with them, so it can be used to replace a "ids list" inside a (PostgreSQL example):INNER JOIN UNNEST('{:idsList}'::int[]) WITH ORDINALITY o(id, ord) ON o.id = myMainTable.id
This allows to retrieve a list of rows, using ids, *in the order the ids are specified*.
-