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) {
inOut = INOUT;
}
dbStoredArgument.setInOut(inOut);
dbStoredArgument.setSeq(i);
dbStoredArgument.setJdbcType(parameterType.getJdbcTypecode());
Name n = parameterType.getNameObject();
String typeName;
if (n instanceof SqlName) {
typeName = ((SqlName)n).getTypeName();
}
else {
typeName = n.getSimpleName();
}
if (isJDBCType) {
dbStoredArgument.setJdbcTypeName(typeName);
}
else {
PLSQLStoredArgument plSqlArg = (PLSQLStoredArgument)dbStoredArgument;
plSqlArg.setPlSqlTypeName(typeName);
plSqlArg.setJdbcTypeName(n.getSimpleName());