public class SimpleUpdateStatementFunction extends Object implements StatementFunction<Integer>, SqlProvider
Constructor and Description |
---|
SimpleUpdateStatementFunction(@Nullable String sql) |
Modifier and Type | Method and Description |
---|---|
Integer |
apply(@NotNull Statement statement)
Gets called by
Database.execute(StatementFunction) . |
@Nullable String |
getSql()
Returns the sql statement related to this implementation.
|
public SimpleUpdateStatementFunction(@Nullable @Nullable String sql)
public Integer apply(@NotNull @NotNull Statement statement) throws SQLException
StatementFunction
Database.execute(StatementFunction)
.
Implementations don't need to worry about handling exceptions:
they will be handled internally by DataOperations
implementations
If the handling is done in async context then implementations should make the details available in some way.
AsyncDataOperations
may place these details inside a never null CompletableFuture object.
ATTENTION: any ResultSet should be closed within this callback implementation. This method doesn't imply that the ResultSet (as other resources) will be closed. Still, this method should grant (as shown in Database various implementations) that the statement will be closed at the end of the operations.
apply
in interface StatementFunction<Integer>
statement
- an active statementSQLException
- if a database error occured. If so, it will be properly handled by implementationsDatabase.update(String, boolean)
,
Database.query(String, ResultSetExtractor)
@Nullable public @Nullable String getSql()
SqlProvider
getSql
in interface SqlProvider
Copyright © 2021. All rights reserved.