Class StatementBuilder
java.lang.Object
me.hsgamer.hscore.database.client.sql.StatementBuilder
The
PreparedStatement
builder-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd values to the current valuesAdd values to the current valuesvoid
consume
(StatementBuilder.ResultSetConsumer consumer) Consume the statementvoid
Consume the statement but ignore the exceptionstatic StatementBuilder
create
(Connection connection) Create a new builder<T> T
execute
(StatementBuilder.Executor<T> executor) Execute the statement<T> T
query
(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 valuesint
update()
Update the statementint
Update 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
-