java.lang.Object
org.seasar.doma.jdbc.query.AbstractQuery
org.seasar.doma.jdbc.query.SqlFileScriptQuery
- All Implemented Interfaces:
Query,ScriptQuery
A query that executes a SQL script file.
This class extends AbstractQuery to provide functionality for executing SQL script
files. It handles script file loading, block delimiter detection, and script execution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe delimiter that separates SQL statements in the script.protected booleanWhether to halt execution when an error occurs.protected StringThe path to the script file.protected URLThe URL of the script file.protected SqlThe SQL annotation if the script is defined inline.protected SqlLogTypeThe SQL log type for this script query.Fields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes this query after execution.Returns the delimiter that separates SQL statements in the script.booleanReturns whether execution should halt on error.intReturns the query timeout in seconds.Returns a supplier that provides a reader for the script content.Returns the path of the script file.Returns the URL of the script file.Sql<?>getSql()Returns the SQL object that represents the query.Returns the SQL log type for this script query.voidprepare()Prepares this query for execution.voidsetBlockDelimiter(String blockDelimiter) Sets the delimiter that separates SQL statements in the script.voidsetHaltOnError(boolean haltOnError) Sets whether to halt execution when an error occurs.voidsetScriptFilePath(String scriptFilePath) Sets the path to the script file.voidsetSqlLogType(SqlLogType sqlLogType) Sets the SQL log type for this script query.Methods inherited from class org.seasar.doma.jdbc.query.AbstractQuery
comment, getClassName, getConfig, getMethod, getMethodName, setCallerClassName, setCallerMethodName, setConfig, setMessage, setMethod, setQueryTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.query.Query
comment, getClassName, getConfig, getMethod, getMethodName
-
Field Details
-
scriptFilePath
The path to the script file. -
blockDelimiter
The delimiter that separates SQL statements in the script. -
haltOnError
protected boolean haltOnErrorWhether to halt execution when an error occurs. -
scriptFileUrl
The URL of the script file. -
sqlAnnotation
The SQL annotation if the script is defined inline. -
sqlLogType
The SQL log type for this script query.
-
-
Constructor Details
-
SqlFileScriptQuery
public SqlFileScriptQuery()
-
-
Method Details
-
setScriptFilePath
Sets the path to the script file.- Parameters:
scriptFilePath- the script file path
-
setBlockDelimiter
Sets the delimiter that separates SQL statements in the script.- Parameters:
blockDelimiter- the block delimiter
-
setHaltOnError
public void setHaltOnError(boolean haltOnError) Sets whether to halt execution when an error occurs.- Parameters:
haltOnError- whether to halt on error
-
setSqlLogType
Sets the SQL log type for this script query.- Parameters:
sqlLogType- the SQL log type
-
prepare
public void prepare()Prepares this query for execution. This method must be called before the query is executed.- Specified by:
preparein interfaceQuery- Overrides:
preparein classAbstractQuery
-
complete
public void complete()Completes this query after execution. This method must be called after the query is executed. -
getQueryTimeout
public int getQueryTimeout()Returns the query timeout in seconds.- Specified by:
getQueryTimeoutin interfaceQuery- Overrides:
getQueryTimeoutin classAbstractQuery- Returns:
- the query timeout
-
getSql
Returns the SQL object that represents the query. -
getScriptFilePath
Returns the path of the script file.- Specified by:
getScriptFilePathin interfaceScriptQuery- Returns:
- the script file path
-
getScriptFileUrl
Returns the URL of the script file.- Specified by:
getScriptFileUrlin interfaceScriptQuery- Returns:
- the URL of the script file
-
getReaderSupplier
Returns a supplier that provides a reader for the script content.- Specified by:
getReaderSupplierin interfaceScriptQuery- Returns:
- the reader supplier
-
getBlockDelimiter
Returns the delimiter that separates SQL statements in the script.- Specified by:
getBlockDelimiterin interfaceScriptQuery- Returns:
- the block delimiter
-
getHaltOnError
public boolean getHaltOnError()Returns whether execution should halt on error.- Specified by:
getHaltOnErrorin interfaceScriptQuery- Returns:
trueif execution should halt on error
-
getSqlLogType
Returns the SQL log type for this script query.- Specified by:
getSqlLogTypein interfaceScriptQuery- Returns:
- the SQL log type
-