Package org.dellroad.stuff.schema
Class SQLCommand
java.lang.Object
org.dellroad.stuff.schema.SQLCommand
- All Implemented Interfaces:
DatabaseAction<Connection>
An SQL
DatabaseAction
that executes a single SQL statement.-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
log
-
-
Constructor Details
-
SQLCommand
Constructor.- Parameters:
sql
- the SQL to execute; must be a single statement- Throws:
IllegalArgumentException
- ifsql
is null or contains only whitespace
-
-
Method Details
-
getSQL
-
apply
Execute the SQL statement.The implementation in
SQLCommand
creates aStatement
and then executes the configured SQL command viaStatement.execute(java.lang.String)
. Subclasses may wish to override.- Specified by:
apply
in interfaceDatabaseAction<Connection>
- Parameters:
c
- open transaction- Throws:
SQLException
- if an error occurs while accessing the database
-