if (methods.size() > 0) {
// we only get more than one method on a OPModel if there is overloading
boolean overloaded = methods.size() > 1;
dbStoredProcedures = new ArrayList<DbStoredProcedure>();
for (int j=0; j<methods.size(); j++) {
ProcedureMethod m = methods.get(j);
DbStoredProcedure dbStoredProcedure = null;
TypeClass returnType = m.getReturnType();
if (returnType == null) {
dbStoredProcedure = new DbStoredProcedure(m.getName());
}
else {
dbStoredProcedure = new DbStoredFunction(m.getName());
DbStoredArgument dbStoredArgument = new DbStoredArgument(returnType.getName());
dbStoredArgument.setInOut(RETURN);
dbStoredArgument.setSeq(0);
dbStoredArgument.setJdbcType(returnType.getJdbcTypecode());
Name n = returnType.getNameObject();
String typeName;
if (n instanceof SqlName) {
typeName = ((SqlName)n).getTypeName();
}
else {
typeName = n.getSimpleName();
}
dbStoredArgument.setJdbcTypeName(typeName);
((DbStoredFunction)dbStoredProcedure).setReturnArg(dbStoredArgument);
}
// only set 'overload' on the stored proc if necessary
if (overloaded) {
// start overload indicator at 1
dbStoredProcedure.setOverload(j+1);
}
dbStoredProcedure.setCatalog(packageName);
dbStoredProcedure.setSchema(originalSchemaPattern);
for (int i = 0, l = m.getParamNames().length; i < l; i ++) {
String argName = m.getParamNames()[i];
TypeClass parameterType = m.getParamTypes()[i];
boolean isJDBCType = parameterType.isPrimitive() || parameterType.isObject() ||
parameterType.isTable() || parameterType.isArray();
DbStoredArgument dbStoredArgument = null;
if (isJDBCType) {
dbStoredArgument = new DbStoredArgument(argName);
}
else {
dbStoredArgument = new PLSQLStoredArgument(argName);
}
int mode = m.getParamModes()[i];
InOut inOut = IN;
if (mode == ProcedureMethod.OUT) {
inOut = OUT;
}
else if (mode == ProcedureMethod.INOUT) {