this.routinesIt = getAIS(session).getRoutines().values().iterator();
}
@Override
public Row next() {
Parameter param;
while (true) {
if (paramsIt != null) {
if (paramsIt.hasNext()) {
param = paramsIt.next();
ordinal++;
break;
}
}
if (!routinesIt.hasNext())
return null;
Routine routine = routinesIt.next();
if (!isAccessible(session, routine.getName()))
continue;
paramsIt = routine.getParameters().iterator();
ordinal = 0;
param = routine.getReturnValue();
if (param != null) {
ordinal++;
break;
}
}
Long length = null;
Long precision = null;
Long scale = null;
Long radix = null;
if (param.getType().hasAttributes(StringAttribute.class))
{
length = (long)param.getType().attribute(StringAttribute.MAX_LENGTH);
} else if (param.getType().hasAttributes(DecimalAttribute.class)) {
precision = (long)param.getType().attribute(DecimalAttribute.PRECISION);
scale = (long)param.getType().attribute(DecimalAttribute.SCALE);
radix = 10L;
}
return new ValuesRow(rowType,
null, //Routine catalog
param.getRoutine().getName().getSchemaName(),
param.getRoutine().getName().getTableName(),
param.getName(),
ordinal,
param.getTypeName(),
length,
precision,
radix,
scale,
(param.getDirection() == Parameter.Direction.RETURN) ? "OUT" : param.getDirection().name(),
boolResult(param.getDirection() == Parameter.Direction.RETURN),
null, //parameter default
++rowCounter /*hidden pk*/);
}