Mrhs121 commented on code in PR #17973:
URL:
https://github.com/apache/dolphinscheduler/pull/17973#discussion_r2808435290
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:
##########
@@ -154,59 +161,50 @@ public void cancel() throws TaskException {
}
}
- private String formatSql(Map<Integer, Property> sqlParamsMap, Map<String,
Property> paramsMap) {
- setSqlParamsMap(procedureParameters.getMethod(), sqlParamsMap,
paramsMap,
- taskExecutionContext.getTaskInstanceId());
- return
procedureParameters.getMethod().replaceAll(TaskConstants.SQL_PARAMS_REGEX, "?");
- }
-
- /**
- * print outParameter
- *
- * @param stmt CallableStatement
- * @param outParameterMap outParameterMap
- * @throws SQLException SQLException
- */
- private void printOutParameter(CallableStatement stmt,
- Map<Integer, Property> outParameterMap)
throws SQLException {
- for (Map.Entry<Integer, Property> en : outParameterMap.entrySet()) {
- int index = en.getKey();
- Property property = en.getValue();
+ // parse the out parameter from stmt and put them into varPool
+ private Map<String, String> parseOutParameters(CallableStatement stmt,
+ Map<Integer, Property>
sqlOutPlaceHolders) throws SQLException {
+ Map<String, String> sqlOutParameters = new HashMap<>();
+ for (Map.Entry<Integer, Property> out : sqlOutPlaceHolders.entrySet())
{
+ int index = out.getKey();
+ Property property = out.getValue();
String prop = property.getProp();
DataType dataType = property.getType();
// get output parameter
-
procedureParameters.dealOutParam4Procedure(getOutputParameter(stmt, index,
prop, dataType), prop);
+ Object outputParameterValue = getOutputParameter(stmt, index,
prop, dataType);
+ sqlOutParameters.put(prop, String.valueOf(outputParameterValue));
}
+ return sqlOutParameters;
}
/**
* get output parameter
*
* @param stmt CallableStatement
- * @param paramsMap paramsMap
+ * @param sqlParams paramsMap
* @return outParameterMap
* @throws Exception Exception
*/
- private Map<Integer, Property> getOutParameterMap(CallableStatement stmt,
Map<Integer, Property> paramsMap,
- Map<String, Property>
totalParamsMap) throws Exception {
+ private Map<Integer, Property> assemblySqlPlaceHolder(CallableStatement
stmt,
+ Map<Integer,
Property> sqlParams,
+ Map<String,
Property> prepareParams) throws Exception {
Map<Integer, Property> outParameterMap = new HashMap<>();
- if (procedureParameters.getLocalParametersMap() == null) {
+ if (MapUtils.isEmpty(sqlParams)) {
Review Comment:
https://github.com/apache/dolphinscheduler/issues/17971 @honkerjha The key
fix to solve this issue
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]