returnType = "last";
else if ("list".equalsIgnoreCase(returnType))
returnValue = new ArrayList<Object>();
else if ("set".equalsIgnoreCase(returnType))
returnValue = new HashSet<Object>();
<BUG>int iterated = 0;
if (foreach != null) {</BUG>
Object result;
if (foreach instanceof ODocument)
result = delegate("foreach", iManager, (ODocument) foreach, iContext, iOutput, iReadOnly);

returnType = "last";
else if ("list".equalsIgnoreCase(returnType))
returnValue = new ArrayList<Object>();
else if ("set".equalsIgnoreCase(returnType))
returnValue = new HashSet<Object>();
int iterated = 0;
final Object beginClause = getField(iContext, iConfig, "begin");
if (beginClause != null)
executeBlock(iManager, iContext, "begin", beginClause, iOutput, iReadOnly, returnType, returnValue);
if (foreach != null) {
Object result;
if (foreach instanceof ODocument)
result = delegate("foreach", iManager, (ODocument) foreach, iContext, iOutput, iReadOnly);
