java.lang.Object
org.seasar.doma.jdbc.command.ScriptCommand
A command to execute SQL scripts.
This command reads and executes SQL statements from a script file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA SQL statement in a script. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ScriptQuerythe queryprotected ScriptExceptionthe saved script exception that occurred during execution -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()Executes the script.getQuery()Returns the query.protected voidLogs the SQL statement.protected voidsetupOptions(Statement statement) Sets up options for the statement.protected voidThrows the saved script exception if it exists.
-
Field Details
-
query
the query -
savedScriptException
the saved script exception that occurred during execution
-
-
Constructor Details
-
ScriptCommand
Creates a new instance.- Parameters:
query- the script query- Throws:
NullPointerException- if the query is null
-
-
Method Details
-
getQuery
Returns the query. -
execute
Executes the script.- Specified by:
executein interfaceCommand<Void>- Returns:
- null
- Throws:
ScriptException- if a script execution error occurs
-
log
Logs the SQL statement.- Parameters:
sql- the SQL statement
-
setupOptions
Sets up options for the statement.- Parameters:
statement- the statement- Throws:
SQLException- if a database access error occurs
-
throwSavedScriptExceptionIfExists
protected void throwSavedScriptExceptionIfExists()Throws the saved script exception if it exists.- Throws:
ScriptException- if a script execution error occurred
-