import org.teiid.core.util.StringUtil; //导入方法依赖的package包/类
private LinkedHashMap convertParameters(Connection conn, String vdbName, String procedureName,
LinkedHashMap inputParameters) throws SQLException {
Map expectedTypes = getParameterTypes(conn, vdbName, procedureName);
LinkedHashMap expectedValues = new LinkedHashMap();
try {
for (String columnName : inputParameters.keySet()) {
Class runtimeType = expectedTypes.get(columnName);
if (runtimeType == null) {
throw new SQLException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50105, columnName,
procedureName));
}
Object value = inputParameters.get(columnName);
if (runtimeType.isAssignableFrom(Array.class)) {
List array = StringUtil.split((String)value, ","); //$NON-NLS-1$
value = array.toArray(new String[array.size()]);
}
else if (runtimeType.isAssignableFrom(DataTypeManager.DefaultDataClasses.VARBINARY)) {
value = Base64.decode((String)value);
}
else {
if (value != null && DataTypeManager.isTransformable(String.class, runtimeType)) {
Transform t = DataTypeManager.getTransform(String.class, runtimeType);
value = t.transform(value, runtimeType);
}
}
expectedValues.put(columnName, value);
}
return expectedValues;
} catch (TransformationException e) {
throw new SQLException(e);
}
}