}
protected void outputResults(ServerJavaRoutine javaRoutine, AkibanAppender appender) throws IOException {
encoder.appendString("{");
boolean first = true;
Routine routine = javaRoutine.getInvocation().getRoutine();
List<Parameter> params = routine.getParameters();
for (int i = 0; i < params.size(); i++) {
Parameter param = params.get(i);
if (param.getDirection() == Parameter.Direction.IN) continue;
String name = param.getName();
if (name == null)
name = String.format("arg%d", i+1);
Object value = javaRoutine.getOutParameter(param, i);
PostgresType pgType = PostgresType.fromAIS(param);
outputValue(name, value, pgType, appender, first);
first = false;
}
if (routine.getReturnValue() != null) {
Object value = javaRoutine.getOutParameter(routine.getReturnValue(),
ServerJavaValues.RETURN_VALUE_INDEX);
PostgresType pgType = PostgresType.fromAIS(routine.getReturnValue());
outputValue("return", value, pgType, appender, first);
first = false;
}
int nresults = 0;
while (!resultSets.isEmpty()) {