query.each()
call the given UDF/Closure with every row (struct) in the query.
query.each( closure=function, parallel=boolean, maxThreads=number )
Returns: Query
| Argument | Description |
|---|---|
|
closure
function,
required
|
edit
A closure function (UDF) with the following signature:
Which is called for each row in the query. Alias: function, callback, udf |
|
parallel
boolean,
optional
|
edit
execute closures parallel |
|
maxThreads
number,
optional
|
edit
maximum number of threads executed, ignored when argument "parallel" is set to false Alias: maxThreadCount |
Examples
edit qry = queryNew( "id, name","cf_sql_integer, cf_sql_varchar", [ [ 1, "Tricia" ],[ 2, "Sarah" ],[ 3, "Joanna" ]] );
writeDump(qry);
testQueryEach='';
qry.Each(function(struct row,numeric rowNumber,query query){
testQueryEach&=row.id&":"&row.name&":"&rowNumber&';';
});
writeDump(testQueryEach);