public.javadoc.org.spincast.plugins.jdbc.statements.Statement.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
Statement (org.spincast:spincast-framework 1.0.0 API)
org.spincast.plugins.jdbc.statements
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
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
void
clearSql()
Clears the current SQL query being built.
void
clearSql(boolean keepCurrentBoundParams)
Clears the current SQL query being built.
String
getSql(boolean friendly)
Returns the current SQL query.
void
setBoolean(String paramName,
Boolean value)
void
setDate(String paramName,
LocalDate date)
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
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
void
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 a IN(:ids)
section.
void
setInStringFromEnumNames(String paramName,
Enum<?>... enumItems)
Uses a list of enum names so it can be used inside a IN(: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 a IN(:ids)
section.
void
setInteger(String paramName,
Integer value)
void
setLong(String paramName,
Long value)
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
setString(String paramName,
String value)
void
sql(String sql)
Appends some SQL to the query to launch.
-
-
Method Detail
-
sql
void sql(String sql)
Appends some SQL to the query to launch.
If you want to restart the query from scratch,
you need to call clearSql()
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
- if true
,
the currently bound parameters won't be cleared, only the
query.
-
getSql
String getSql(boolean friendly)
Returns the current SQL query.
-
setInLong
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
-
setInInteger
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
-
setInString
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.
-
setInStringFromEnumNames
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 a IN(:ids)
section.
-
setInStringFromEnumNames
void setInStringFromEnumNames(String paramName,
Enum<?>... enumItems)
Uses a list of enum names so it can be used inside a IN(:ids)
section.
-
setLongList
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
This allows to retrieve a list of rows, using ids, *in the
order the ids are specified*.
Copyright © 2019. All rights reserved.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy