|
|
@ -16,29 +16,47 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.apache.dolphinscheduler.server.worker.task.processdure; |
|
|
|
package org.apache.dolphinscheduler.server.worker.task.processdure; |
|
|
|
|
|
|
|
|
|
|
|
import com.cronutils.utils.StringUtils; |
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.BOOLEAN; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.DATE; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.DOUBLE; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.FLOAT; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.INTEGER; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.LONG; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.TIME; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.TIMESTAMP; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.VARCHAR; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.enums.*; |
|
|
|
import org.apache.dolphinscheduler.common.enums.CommandType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.DataType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.DbType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.Direct; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy; |
|
|
|
import org.apache.dolphinscheduler.common.process.Property; |
|
|
|
import org.apache.dolphinscheduler.common.process.Property; |
|
|
|
import org.apache.dolphinscheduler.common.task.AbstractParameters; |
|
|
|
import org.apache.dolphinscheduler.common.task.AbstractParameters; |
|
|
|
import org.apache.dolphinscheduler.common.task.procedure.ProcedureParameters; |
|
|
|
import org.apache.dolphinscheduler.common.task.procedure.ProcedureParameters; |
|
|
|
import org.apache.dolphinscheduler.common.utils.CollectionUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.CollectionUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.*; |
|
|
|
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.ParameterUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.ParameterUtils; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.utils.StringUtils; |
|
|
|
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource; |
|
|
|
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource; |
|
|
|
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory; |
|
|
|
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory; |
|
|
|
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; |
|
|
|
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; |
|
|
|
import org.apache.dolphinscheduler.server.utils.ParamUtils; |
|
|
|
import org.apache.dolphinscheduler.server.utils.ParamUtils; |
|
|
|
import org.apache.dolphinscheduler.server.worker.task.AbstractTask; |
|
|
|
import org.apache.dolphinscheduler.server.worker.task.AbstractTask; |
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.sql.*; |
|
|
|
import java.sql.CallableStatement; |
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
|
|
|
|
import java.sql.DriverManager; |
|
|
|
|
|
|
|
import java.sql.PreparedStatement; |
|
|
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
|
|
|
import java.sql.Types; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.enums.DataType.*; |
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* procedure task |
|
|
|
* procedure task |
|
|
@ -63,6 +81,7 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* constructor |
|
|
|
* constructor |
|
|
|
|
|
|
|
* |
|
|
|
* @param taskExecutionContext taskExecutionContext |
|
|
|
* @param taskExecutionContext taskExecutionContext |
|
|
|
* @param logger logger |
|
|
|
* @param logger logger |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -111,7 +130,6 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
baseDataSource.getPassword()); |
|
|
|
baseDataSource.getPassword()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// combining local and global parameters
|
|
|
|
// combining local and global parameters
|
|
|
|
Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), |
|
|
|
Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), |
|
|
|
taskExecutionContext.getDefinedParams(), |
|
|
|
taskExecutionContext.getDefinedParams(), |
|
|
@ -122,13 +140,13 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
|
|
|
|
|
|
|
|
Collection<Property> userDefParamsList = null; |
|
|
|
Collection<Property> userDefParamsList = null; |
|
|
|
|
|
|
|
|
|
|
|
if (procedureParameters.getLocalParametersMap() != null){ |
|
|
|
if (procedureParameters.getLocalParametersMap() != null) { |
|
|
|
userDefParamsList = procedureParameters.getLocalParametersMap().values(); |
|
|
|
userDefParamsList = procedureParameters.getLocalParametersMap().values(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String method = getCallMethod(userDefParamsList); |
|
|
|
String method = getCallMethod(userDefParamsList); |
|
|
|
|
|
|
|
|
|
|
|
logger.info("call method : {}",method); |
|
|
|
logger.info("call method : {}", method); |
|
|
|
|
|
|
|
|
|
|
|
// call method
|
|
|
|
// call method
|
|
|
|
stmt = connection.prepareCall(method); |
|
|
|
stmt = connection.prepareCall(method); |
|
|
@ -148,48 +166,48 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
printOutParameter(stmt, outParameterMap); |
|
|
|
printOutParameter(stmt, outParameterMap); |
|
|
|
|
|
|
|
|
|
|
|
setExitStatusCode(Constants.EXIT_CODE_SUCCESS); |
|
|
|
setExitStatusCode(Constants.EXIT_CODE_SUCCESS); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
setExitStatusCode(Constants.EXIT_CODE_FAILURE); |
|
|
|
setExitStatusCode(Constants.EXIT_CODE_FAILURE); |
|
|
|
logger.error("procedure task error",e); |
|
|
|
logger.error("procedure task error", e); |
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
close(stmt, connection); |
|
|
|
close(stmt,connection); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get call method |
|
|
|
* get call method |
|
|
|
|
|
|
|
* |
|
|
|
* @param userDefParamsList userDefParamsList |
|
|
|
* @param userDefParamsList userDefParamsList |
|
|
|
* @return method |
|
|
|
* @return method |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String getCallMethod(Collection<Property> userDefParamsList) { |
|
|
|
private String getCallMethod(Collection<Property> userDefParamsList) { |
|
|
|
String method;// no parameters
|
|
|
|
String method;// no parameters
|
|
|
|
if (CollectionUtils.isEmpty(userDefParamsList)){ |
|
|
|
if (CollectionUtils.isEmpty(userDefParamsList)) { |
|
|
|
method = "{call " + procedureParameters.getMethod() + "}"; |
|
|
|
method = "{call " + procedureParameters.getMethod() + "}"; |
|
|
|
}else { // exists parameters
|
|
|
|
} else { // exists parameters
|
|
|
|
int size = userDefParamsList.size(); |
|
|
|
int size = userDefParamsList.size(); |
|
|
|
StringBuilder parameter = new StringBuilder(); |
|
|
|
StringBuilder parameter = new StringBuilder(); |
|
|
|
parameter.append("("); |
|
|
|
parameter.append("("); |
|
|
|
for (int i = 0 ;i < size - 1; i++){ |
|
|
|
for (int i = 0; i < size - 1; i++) { |
|
|
|
parameter.append("?,"); |
|
|
|
parameter.append("?,"); |
|
|
|
} |
|
|
|
} |
|
|
|
parameter.append("?)"); |
|
|
|
parameter.append("?)"); |
|
|
|
method = "{call " + procedureParameters.getMethod() + parameter.toString()+ "}"; |
|
|
|
method = "{call " + procedureParameters.getMethod() + parameter.toString() + "}"; |
|
|
|
} |
|
|
|
} |
|
|
|
return method; |
|
|
|
return method; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* print outParameter |
|
|
|
* print outParameter |
|
|
|
|
|
|
|
* |
|
|
|
* @param stmt CallableStatement |
|
|
|
* @param stmt CallableStatement |
|
|
|
* @param outParameterMap outParameterMap |
|
|
|
* @param outParameterMap outParameterMap |
|
|
|
* @throws SQLException |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void printOutParameter(CallableStatement stmt, |
|
|
|
private void printOutParameter(CallableStatement stmt, |
|
|
|
Map<Integer, Property> outParameterMap) throws SQLException { |
|
|
|
Map<Integer, Property> outParameterMap) throws SQLException { |
|
|
|
Iterator<Map.Entry<Integer, Property>> iter = outParameterMap.entrySet().iterator(); |
|
|
|
Iterator<Map.Entry<Integer, Property>> iter = outParameterMap.entrySet().iterator(); |
|
|
|
while (iter.hasNext()){ |
|
|
|
while (iter.hasNext()) { |
|
|
|
Map.Entry<Integer, Property> en = iter.next(); |
|
|
|
Map.Entry<Integer, Property> en = iter.next(); |
|
|
|
|
|
|
|
|
|
|
|
int index = en.getKey(); |
|
|
|
int index = en.getKey(); |
|
|
@ -208,27 +226,26 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
* @param paramsMap paramsMap |
|
|
|
* @param paramsMap paramsMap |
|
|
|
* @param userDefParamsList userDefParamsList |
|
|
|
* @param userDefParamsList userDefParamsList |
|
|
|
* @return outParameterMap |
|
|
|
* @return outParameterMap |
|
|
|
* @throws Exception |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<Integer, Property> getOutParameterMap(CallableStatement stmt, |
|
|
|
private Map<Integer, Property> getOutParameterMap(CallableStatement stmt, |
|
|
|
Map<String, Property> paramsMap, |
|
|
|
Map<String, Property> paramsMap, |
|
|
|
Collection<Property> userDefParamsList) throws Exception { |
|
|
|
Collection<Property> userDefParamsList) throws Exception { |
|
|
|
Map<Integer,Property> outParameterMap = new HashMap<>(); |
|
|
|
Map<Integer, Property> outParameterMap = new HashMap<>(); |
|
|
|
if (userDefParamsList != null && userDefParamsList.size() > 0){ |
|
|
|
if (userDefParamsList != null && userDefParamsList.size() > 0) { |
|
|
|
int index = 1; |
|
|
|
int index = 1; |
|
|
|
for (Property property : userDefParamsList){ |
|
|
|
for (Property property : userDefParamsList) { |
|
|
|
logger.info("localParams : prop : {} , dirct : {} , type : {} , value : {}" |
|
|
|
logger.info("localParams : prop : {} , dirct : {} , type : {} , value : {}" |
|
|
|
,property.getProp(), |
|
|
|
, property.getProp(), |
|
|
|
property.getDirect(), |
|
|
|
property.getDirect(), |
|
|
|
property.getType(), |
|
|
|
property.getType(), |
|
|
|
property.getValue()); |
|
|
|
property.getValue()); |
|
|
|
// set parameters
|
|
|
|
// set parameters
|
|
|
|
if (property.getDirect().equals(Direct.IN)){ |
|
|
|
if (property.getDirect().equals(Direct.IN)) { |
|
|
|
ParameterUtils.setInParameter(index, stmt, property.getType(), paramsMap.get(property.getProp()).getValue()); |
|
|
|
ParameterUtils.setInParameter(index, stmt, property.getType(), paramsMap.get(property.getProp()).getValue()); |
|
|
|
}else if (property.getDirect().equals(Direct.OUT)){ |
|
|
|
} else if (property.getDirect().equals(Direct.OUT)) { |
|
|
|
setOutParameter(index,stmt,property.getType(),paramsMap.get(property.getProp()).getValue()); |
|
|
|
setOutParameter(index, stmt, property.getType(), paramsMap.get(property.getProp()).getValue()); |
|
|
|
property.setValue(paramsMap.get(property.getProp()).getValue()); |
|
|
|
property.setValue(paramsMap.get(property.getProp()).getValue()); |
|
|
|
outParameterMap.put(index,property); |
|
|
|
outParameterMap.put(index, property); |
|
|
|
} |
|
|
|
} |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
@ -237,26 +254,22 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* set timtou |
|
|
|
* set timeout |
|
|
|
|
|
|
|
* |
|
|
|
* @param stmt CallableStatement |
|
|
|
* @param stmt CallableStatement |
|
|
|
* @throws SQLException |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void setTimeout(CallableStatement stmt) throws SQLException { |
|
|
|
private void setTimeout(CallableStatement stmt) throws SQLException { |
|
|
|
Boolean failed = TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.FAILED; |
|
|
|
Boolean failed = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED; |
|
|
|
Boolean warnfailed = TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.WARNFAILED; |
|
|
|
Boolean warnFailed = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; |
|
|
|
if(failed || warnfailed){ |
|
|
|
if (failed || warnFailed) { |
|
|
|
stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); |
|
|
|
stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* close jdbc resource |
|
|
|
* close jdbc resource |
|
|
|
* |
|
|
|
|
|
|
|
* @param stmt |
|
|
|
|
|
|
|
* @param connection |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void close(PreparedStatement stmt, |
|
|
|
private void close(PreparedStatement stmt, Connection connection) { |
|
|
|
Connection connection){ |
|
|
|
|
|
|
|
if (stmt != null) { |
|
|
|
if (stmt != null) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
stmt.close(); |
|
|
|
stmt.close(); |
|
|
@ -275,40 +288,35 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get output parameter |
|
|
|
* get output parameter |
|
|
|
* @param stmt |
|
|
|
|
|
|
|
* @param index |
|
|
|
|
|
|
|
* @param prop |
|
|
|
|
|
|
|
* @param dataType |
|
|
|
|
|
|
|
* @throws SQLException |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void getOutputParameter(CallableStatement stmt, int index, String prop, DataType dataType) throws SQLException { |
|
|
|
private void getOutputParameter(CallableStatement stmt, int index, String prop, DataType dataType) throws SQLException { |
|
|
|
switch (dataType){ |
|
|
|
switch (dataType) { |
|
|
|
case VARCHAR: |
|
|
|
case VARCHAR: |
|
|
|
logger.info("out prameter varchar key : {} , value : {}",prop,stmt.getString(index)); |
|
|
|
logger.info("out prameter varchar key : {} , value : {}", prop, stmt.getString(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case INTEGER: |
|
|
|
case INTEGER: |
|
|
|
logger.info("out prameter integer key : {} , value : {}", prop, stmt.getInt(index)); |
|
|
|
logger.info("out prameter integer key : {} , value : {}", prop, stmt.getInt(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case LONG: |
|
|
|
case LONG: |
|
|
|
logger.info("out prameter long key : {} , value : {}",prop,stmt.getLong(index)); |
|
|
|
logger.info("out prameter long key : {} , value : {}", prop, stmt.getLong(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case FLOAT: |
|
|
|
case FLOAT: |
|
|
|
logger.info("out prameter float key : {} , value : {}",prop,stmt.getFloat(index)); |
|
|
|
logger.info("out prameter float key : {} , value : {}", prop, stmt.getFloat(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case DOUBLE: |
|
|
|
case DOUBLE: |
|
|
|
logger.info("out prameter double key : {} , value : {}",prop,stmt.getDouble(index)); |
|
|
|
logger.info("out prameter double key : {} , value : {}", prop, stmt.getDouble(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case DATE: |
|
|
|
case DATE: |
|
|
|
logger.info("out prameter date key : {} , value : {}",prop,stmt.getDate(index)); |
|
|
|
logger.info("out prameter date key : {} , value : {}", prop, stmt.getDate(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TIME: |
|
|
|
case TIME: |
|
|
|
logger.info("out prameter time key : {} , value : {}",prop,stmt.getTime(index)); |
|
|
|
logger.info("out prameter time key : {} , value : {}", prop, stmt.getTime(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TIMESTAMP: |
|
|
|
case TIMESTAMP: |
|
|
|
logger.info("out prameter timestamp key : {} , value : {}",prop,stmt.getTimestamp(index)); |
|
|
|
logger.info("out prameter timestamp key : {} , value : {}", prop, stmt.getTimestamp(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BOOLEAN: |
|
|
|
case BOOLEAN: |
|
|
|
logger.info("out prameter boolean key : {} , value : {}",prop, stmt.getBoolean(index)); |
|
|
|
logger.info("out prameter boolean key : {} , value : {}", prop, stmt.getBoolean(index)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -322,72 +330,73 @@ public class ProcedureTask extends AbstractTask { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* set out parameter |
|
|
|
* set out parameter |
|
|
|
|
|
|
|
* |
|
|
|
* @param index index |
|
|
|
* @param index index |
|
|
|
* @param stmt stmt |
|
|
|
* @param stmt stmt |
|
|
|
* @param dataType dataType |
|
|
|
* @param dataType dataType |
|
|
|
* @param value value |
|
|
|
* @param value value |
|
|
|
* @throws Exception exception |
|
|
|
* @throws Exception exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void setOutParameter(int index,CallableStatement stmt,DataType dataType,String value)throws Exception{ |
|
|
|
private void setOutParameter(int index, CallableStatement stmt, DataType dataType, String value) throws Exception { |
|
|
|
if (dataType.equals(VARCHAR)){ |
|
|
|
if (dataType.equals(VARCHAR)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.VARCHAR); |
|
|
|
stmt.registerOutParameter(index, Types.VARCHAR); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.VARCHAR, value); |
|
|
|
stmt.registerOutParameter(index, Types.VARCHAR, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(INTEGER)){ |
|
|
|
} else if (dataType.equals(INTEGER)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER); |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER, value); |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(LONG)){ |
|
|
|
} else if (dataType.equals(LONG)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index,Types.INTEGER); |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index,Types.INTEGER ,value); |
|
|
|
stmt.registerOutParameter(index, Types.INTEGER, value); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if (dataType.equals(FLOAT)){ |
|
|
|
} else if (dataType.equals(FLOAT)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.FLOAT); |
|
|
|
stmt.registerOutParameter(index, Types.FLOAT); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.FLOAT,value); |
|
|
|
stmt.registerOutParameter(index, Types.FLOAT, value); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if (dataType.equals(DOUBLE)){ |
|
|
|
} else if (dataType.equals(DOUBLE)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.DOUBLE); |
|
|
|
stmt.registerOutParameter(index, Types.DOUBLE); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.DOUBLE , value); |
|
|
|
stmt.registerOutParameter(index, Types.DOUBLE, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(DATE)){ |
|
|
|
} else if (dataType.equals(DATE)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.DATE); |
|
|
|
stmt.registerOutParameter(index, Types.DATE); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.DATE , value); |
|
|
|
stmt.registerOutParameter(index, Types.DATE, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(TIME)){ |
|
|
|
} else if (dataType.equals(TIME)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.TIME); |
|
|
|
stmt.registerOutParameter(index, Types.TIME); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.TIME , value); |
|
|
|
stmt.registerOutParameter(index, Types.TIME, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(TIMESTAMP)){ |
|
|
|
} else if (dataType.equals(TIMESTAMP)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.TIMESTAMP); |
|
|
|
stmt.registerOutParameter(index, Types.TIMESTAMP); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.TIMESTAMP , value); |
|
|
|
stmt.registerOutParameter(index, Types.TIMESTAMP, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (dataType.equals(BOOLEAN)){ |
|
|
|
} else if (dataType.equals(BOOLEAN)) { |
|
|
|
if (StringUtils.isEmpty(value)){ |
|
|
|
if (StringUtils.isEmpty(value)) { |
|
|
|
stmt.registerOutParameter(index, Types.BOOLEAN); |
|
|
|
stmt.registerOutParameter(index, Types.BOOLEAN); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
stmt.registerOutParameter(index, Types.BOOLEAN , value); |
|
|
|
stmt.registerOutParameter(index, Types.BOOLEAN, value); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|