super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), type.getTypeName());
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode());
}
} else {
ComplexDatabaseType complexType = (ComplexDatabaseType) type;
if (inArg.inIndex != MIN_VALUE) {
if (complexType.isStruct()) {
super.addNamedArgument(inArg.name, inArg.name, complexType.getSqlCode(), complexType.getTypeName());
} else if (complexType.isArray()) {
DatabaseType nestedType = ((OracleArrayType) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField("");
field.setSqlType(nestedType.getSqlCode());
field.setSqlTypeName(nestedType.getTypeName());
super.addNamedArgument(inArg.name, inArg.name, complexType.getSqlCode(), complexType.getTypeName(), field);
} else {
super.addNamedArgument(inArg.name, inArg.name, complexType.getSqlCode(), complexType.getTypeName());
}
} else if (complexType.isCollection()) {
DatabaseType nestedType = ((PLSQLCollection) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField("");
field.setSqlType(nestedType.getConversionCode());
if (nestedType.isComplexDatabaseType()) {
field.setSqlTypeName(((ComplexDatabaseType) nestedType).getCompatibleType());
}
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType(), field);
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
}
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
}
}
}
}
List<PLSQLargument> outArguments = getArguments(arguments, OUT);
outArguments.addAll(inOutArguments);
for (ListIterator<PLSQLargument> outArgsIter = outArguments.listIterator(); outArgsIter.hasNext();) {
PLSQLargument outArg = outArgsIter.next();
newIndex = outArg.databaseType.computeOutIndex(outArg, newIndex, outArgsIter);
}
for (PLSQLargument outArg : outArguments) {
if (outArg.cursorOutput) {
super.useNamedCursorOutputAsResultSet(outArg.name);
} else {
DatabaseType type = outArg.databaseType;
if (!type.isComplexDatabaseType()) {
// for XMLType, we need to set type name parameter (will be "XMLTYPE")
if (type == XMLType) {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), type.getTypeName());
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode());
}
} else {
ComplexDatabaseType complexType = (ComplexDatabaseType) type;
if (outArg.outIndex != MIN_VALUE) {
if (complexType.isStruct()) {
super.addNamedOutputArgument(outArg.name, outArg.name, complexType.getSqlCode(), complexType.getTypeName(), complexType.getJavaType());
} else if (complexType.isArray()) {
DatabaseType nestedType = ((OracleArrayType) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField("");
nestedField.setSqlType(nestedType.getSqlCode());
if (nestedType.isComplexDatabaseType()) {
ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
nestedField.setType(complexNestedType.getJavaType());
nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
}
super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType(), nestedField);
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType());
}
} else if (complexType.isCollection()) {
DatabaseType nestedType = ((PLSQLCollection) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField(outArg.name);
nestedField.setSqlType(nestedType.getSqlCode());
if (nestedType.isComplexDatabaseType()) {
ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
nestedField.setType(complexNestedType.getJavaType());
nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
}
super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField);
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType());
}