Class StatementBuilder
java.lang.Object
me.hsgamer.hscore.database.client.sql.StatementBuilder
The
PreparedStatement builder-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAdd values to the current valuesAdd values to the current valuesvoidconsume(StatementBuilder.ResultSetConsumer consumer) Consume the statementvoidConsume the statement but ignore the exceptionstatic StatementBuildercreate(Connection connection) Create a new builder<T> Texecute(StatementBuilder.Executor<T> executor) Execute the statement<T> Tquery(StatementBuilder.ResultSetConverter<T> converter) Query the statement<T> List<T> queryList(StatementBuilder.ResultSetConverter<T> converter) Query the statement and return a listqueryListSafe(StatementBuilder.ResultSetConverter<T> converter) Query the statement and return a list but ignore the exception<T> Optional<T> querySafe(StatementBuilder.ResultSetConverter<T> converter) Query the statement but ignore the exceptionsetStatement(String statement) Set the statementSet the valuesSet the valuesintupdate()Update the statementintUpdate the statement but ignore the exception
-
Method Details
-
create
Create a new builder- Parameters:
connection- the connection- Returns:
- the builder
-
setStatement
Set the statement- Parameters:
statement- the statement- Returns:
- the builder for chaining
-
setValues
Set the values- Parameters:
values- the values- Returns:
- the builder for chaining
-
setValues
Set the values- Parameters:
values- the values- Returns:
- the builder for chaining
-
addValues
Add values to the current values- Parameters:
values- the values- Returns:
- the builder for chaining
-
addValues
Add values to the current values- Parameters:
values- the values- Returns:
- the builder for chaining
-
execute
Execute the statement- Type Parameters:
T- the result type- Parameters:
executor- the executor- Returns:
- the result
- Throws:
SQLException- if a SQL error occurs
-
query
Query the statement- Type Parameters:
T- the result type- Parameters:
converter- the converter- Returns:
- the result
- Throws:
SQLException- if a SQL error occurs
-
queryList
Query the statement and return a list- Type Parameters:
T- the result type- Parameters:
converter- the converter- Returns:
- the result
- Throws:
SQLException- if a SQL error occurs
-
consume
Consume the statement- Parameters:
consumer- the consumer- Throws:
SQLException- if a SQL error occurs
-
update
Update the statement- Returns:
- the result
- Throws:
SQLException- if a SQL error occurs
-
querySafe
Query the statement but ignore the exception- Type Parameters:
T- the result type- Parameters:
converter- the converter- Returns:
- the result
-
queryListSafe
Query the statement and return a list but ignore the exception- Type Parameters:
T- the result type- Parameters:
converter- the converter- Returns:
- the result
-
consumeSafe
Consume the statement but ignore the exception- Parameters:
consumer- the consumer
-
updateSafe
public int updateSafe()Update the statement but ignore the exception- Returns:
- the result
-