com.massimo.tools.scriptrunner.work
Class SQLFunctionTask
java.lang.Object
com.massimo.tools.scriptrunner.AbstractTask
com.massimo.tools.scriptrunner.work.SQLTask
com.massimo.tools.scriptrunner.work.SQLFunctionTask
- All Implemented Interfaces:
- Task
- Direct Known Subclasses:
- OracleFileCheckTask
public class SQLFunctionTask
- extends SQLTask
Execute a SQL function.
The integer return value is used as the script result.
Fields inherited from class com.massimo.tools.scriptrunner.work.SQLTask |
BIND_END_DELIMITERS, bindNames, connection, dbType, run_id, SQL_CHECK_PREFIX_ORACLE, SQL_CHECK_PREFIX_POSTGRES, SQL_CHECK_SUFFIX_ORACLE, SQL_CHECK_SUFFIX_POSTGRES, SQL_NON_COMMENT_PATTERN, SQL_STMT_PATTERN_ORACLE, SQL_STMT_PATTERN_POSTGRES |
Methods inherited from class com.massimo.tools.scriptrunner.work.SQLTask |
doProcess, doValidate, finalize, getBindNames, getSQLSplitPattern, getSQLWarning, postCheck, preCheck, setBinds, substitiuteBinds, validateBinds |
Methods inherited from class com.massimo.tools.scriptrunner.AbstractTask |
getBooleanProperty, getCurrentWorkingDirectory, getDefinition, getIntProperty, getName, getParent, getProperties, getStartProcessingRow, getText, getType, interrupt, isIgnoreableError, isIgnoreableError, isInterrupted, isLogProgress, postProcess, preProcess, process, resultCodeToString, substituteParameters, toString, validate, validateConnections, validateParameters |
SQL_FN_PREFIX_ORACLE
protected static final String SQL_FN_PREFIX_ORACLE
- See Also:
- Constant Field Values
SQL_FN_PREFIX_POSTGRES
protected static final String SQL_FN_PREFIX_POSTGRES
- See Also:
- Constant Field Values
SQL_FN_SUFFIX_ORACLE
protected static final String SQL_FN_SUFFIX_ORACLE
- See Also:
- Constant Field Values
SQL_FN_SUFFIX_POSTGRES
protected static final String SQL_FN_SUFFIX_POSTGRES
- See Also:
- Constant Field Values
SQLFunctionTask
public SQLFunctionTask(Task parent,
String type,
Element definition,
Map<String,String> contextProperties)
throws Exception
- Parameters:
parent
- type
- definition
- contextProperties
-
- Throws:
Exception
executeSQL
protected int executeSQL(ExecutionContext context,
String sqlText)
throws SQLException,
SRException
- Overrides:
executeSQL
in class SQLTask
- Returns:
- result code from executing the sql fragment
- Throws:
SQLException
SRException
- See Also:
SQLTask.executeSQL(com.massimo.tools.scriptrunner.context.ExecutionContext, java.lang.String)
getBindValues
protected Object[] getBindValues(List<String> binds)
- This is closely related to SQLTask.setBinds(java.sql.PreparedStatement, List).
- Parameters:
binds
-
- Returns:
- Array of bind variable values
getLogger
protected org.apache.log4j.Logger getLogger()
-
- Overrides:
getLogger
in class SQLTask
- Returns:
- Class logger
getSQLText
protected String getSQLText()
- Description copied from class:
SQLTask
- Sub-classes may override this if the SQL is not simply the XML text.
- Overrides:
getSQLText
in class SQLTask
- Returns:
- SQL text
- See Also:
SQLTask.getSQLText()
parseTextIntoStatements
protected String[] parseTextIntoStatements(String parameterizedText)
- Description copied from class:
SQLTask
- Break the text up into individaul statments.
This is based on finding the execution character, '/', on a line by itself.
Each statement is further processed:
- SHOW ERRORS is ignored
- '--' comment lines are ignored
- 'REM' comment lines are ignored
- Overrides:
parseTextIntoStatements
in class SQLTask
- Returns:
- Array of statements, which may be null.
- See Also:
SQLTask.parseTextIntoStatements(java.lang.String)
validateSQL
protected int validateSQL(String sqlText,
ValidationContext context)
- Overrides:
validateSQL
in class SQLTask
- See Also:
SQLTask.validateSQL(java.lang.String, com.massimo.tools.scriptrunner.context.ValidationContext)