use of lucee.runtime.type.it.ForEachQueryIterator in project Lucee by lucee.
the class Map method invoke.
private static Query invoke(PageContext pc, Query qry, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures, Query rtn) throws PageException {
Key[] colNames = qry.getColumnNames();
if (rtn == null) {
rtn = new QueryImpl(colNames, 0, qry.getName());
} else {
// check if we have the necessary columns
for (Key colName : colNames) {
if (rtn.getColumn(colName, null) == null) {
rtn.addColumn(colName, new ArrayImpl());
}
}
}
final int pid = pc.getId();
ForEachQueryIterator it = new ForEachQueryIterator(qry, pid);
int rowNbr;
Object row, res;
boolean async = es != null;
while (it.hasNext()) {
row = it.next();
rowNbr = qry.getCurrentrow(pid);
res = _inv(pc, udf, new Object[] { row, rowNbr, qry }, rowNbr, es, futures);
if (!async) {
addRow(Caster.toStruct(res), rtn);
}
}
return rtn;
}
use of lucee.runtime.type.it.ForEachQueryIterator in project Lucee by lucee.
the class Some method invoke.
private static boolean invoke(PageContext pc, Query qry, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures) throws CasterException, PageException {
final int pid = pc.getId();
ForEachQueryIterator it = new ForEachQueryIterator(qry, pid);
boolean async = es != null;
double r;
Object res, row;
try {
while (it.hasNext()) {
row = it.next();
r = Caster.toDoubleValue(qry.getCurrentrow(pid));
res = _inv(pc, udf, new Object[] { row, r, qry }, r, row, es, futures);
if (!async && Caster.toBooleanValue(res)) {
return true;
}
}
} finally {
it.reset();
}
return false;
}
Aggregations