java.lang.Object
org.seasar.doma.jdbc.query.AbstractQuery
org.seasar.doma.jdbc.query.SqlProcessorQuery
- All Implemented Interfaces:
Query
A query that processes SQL files. This class is responsible for loading SQL files and building
prepared SQL statements with parameter binding.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe parameters to be bound to the SQL.protected PreparedSqlThe prepared SQL statement.protected SqlFileThe SQL file.protected StringThe path to the SQL file.Fields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(String name, Class<?> type, Object value) Adds a parameter to be bound to the SQL.voidcomplete()Completes this query.getSql()Returns the prepared SQL statement.voidprepare()Prepares this query for execution.protected voidPrepares the SQL statement by loading the SQL file and building the prepared SQL.voidsetSqlFilePath(String sqlFilePath) Sets the path to the SQL file.Methods inherited from class org.seasar.doma.jdbc.query.AbstractQuery
comment, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout, setCallerClassName, setCallerMethodName, setConfig, setMessage, setMethod, setQueryTimeout
-
Field Details
-
parameters
The parameters to be bound to the SQL. -
sqlFilePath
The path to the SQL file. -
sqlFile
The SQL file. -
sql
The prepared SQL statement.
-
-
Constructor Details
-
SqlProcessorQuery
public SqlProcessorQuery()
-
-
Method Details
-
setSqlFilePath
Sets the path to the SQL file.- Parameters:
sqlFilePath- the SQL file path
-
addParameter
Adds a parameter to be bound to the SQL.- Parameters:
name- the parameter nametype- the parameter typevalue- the parameter value
-
prepare
public void prepare()Prepares this query for execution. This method must be called beforegetSql().- Specified by:
preparein interfaceQuery- Overrides:
preparein classAbstractQuery
-
prepareSql
protected void prepareSql()Prepares the SQL statement by loading the SQL file and building the prepared SQL. -
getSql
Returns the prepared SQL statement.- Returns:
- the prepared SQL statement
-
complete
public void complete()Completes this query. This method is called after the query execution.
-