@Immutable public final class SqlOperation extends java.lang.Object implements Operation
Statement.executeUpdate(String)
). It can be useful,
for example, to disable or re-enable constraints before/after deleting everything from tables, or inserting into
tables having cross references.Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
void |
execute(java.sql.Connection connection,
BinderConfiguration configuration)
Executes the operation
|
int |
hashCode() |
static Operation |
of(java.util.List<java.lang.String> sqlStatements)
Creates a sequence of SqlOperation for the given SQL statements.
|
static Operation |
of(java.lang.String... sqlStatements)
Creates a sequence of SqlOperation for the given SQL statements.
|
static SqlOperation |
of(java.lang.String sqlStatement)
Creates a SqlOperation for the given SQL statement
|
java.lang.String |
toString() |
public void execute(java.sql.Connection connection, BinderConfiguration configuration) throws java.sql.SQLException
Operation
execute
in interface Operation
connection
- the connection used to execute the operationconfiguration
- the binder configuration, used to get appropriate binders based on the metadata of
the prepared statementsjava.sql.SQLException
- if the execution throws a SQLExceptionpublic static SqlOperation of(@Nonnull java.lang.String sqlStatement)
sqlStatement
- the SQL statement to executepublic static Operation of(@Nonnull java.lang.String... sqlStatements)
sqlStatements
- the SQL statements to executepublic static Operation of(@Nonnull java.util.List<java.lang.String> sqlStatements)
sqlStatements
- the SQL statements to executepublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object