* INTERNAL:
* Return Record containing output fields and values.
* Called only if shouldBuildOutputRow method returns true.
*/
public AbstractRecord buildOutputRow(CallableStatement statement) throws SQLException {
AbstractRecord row = new DatabaseRecord();
for (int index = 0; index < parameters.size(); index++) {
Object parameter = parameters.elementAt(index);
if (parameter instanceof OutputParameterForCallableStatement) {
OutputParameterForCallableStatement outParameter = (OutputParameterForCallableStatement)parameter;
if (!outParameter.isCursor()) {
Object value = statement.getObject(index + 1);
DatabaseField field = outParameter.getOutputField();
if (value instanceof Struct){
ClassDescriptor descriptor = this.getQuery().getSession().getDescriptor(field.getType());
if ((value!=null) && (descriptor!=null) && (descriptor.isObjectRelationalDataTypeDescriptor())){
AbstractRecord nestedRow = ((ObjectRelationalDataTypeDescriptor)descriptor).buildRowFromStructure((Struct)value);
ReadObjectQuery query = new ReadObjectQuery();
query.setSession(this.getQuery().getSession());
value = descriptor.getObjectBuilder().buildNewInstance();
descriptor.getObjectBuilder().buildAttributesIntoObject(value, nestedRow, query, null, false);
}
} else if ((value instanceof Array)&&( field.isObjectRelationalDatabaseField() )){
value = ObjectRelationalDataTypeDescriptor.buildContainerFromArray((Array)value, (ObjectRelationalDatabaseField)field, this.getQuery().getSession());
}
row.put(field, value);
}
}
}
return row;