queryMap

Maps each query row using a function to manipulate the rows fields

queryMap(query, closure [, parallel] [, maxThreads]) → returns query

Member Function Syntax

query.map(closure [, parallel] [, maxThreads])

queryMap Argument Reference

query query
Required

closure function
Required

parallel boolean

maxThreads numeric
Default: 20

Links more information about queryMap

Examples sample code invoking the queryMap function

Manipulates query column

news = queryNew("id,title",
	"integer,varchar", [{
		"id": 1,
		"title": "Dewey defeats Truman"
	}, {
		"id": 2,
		"title": "Man walks on Moon"
	}]
);

writeDump(news);

function mapQuery(any Obj) {
	if (Obj.id == 1)
		Obj.title = "NEW: " & Obj.title;
	return Obj;
}

newQuery = QueryMap(news, mapQuery);
writeDump(newQuery);

Fork me on GitHub