processRow()
The processRow() method is called once for each row of data and can return 0 or more rows of data back to the database.
To return 0 rows, return the value null.
function processRow(x)
return null
end
To return a single row, return a table that contains one value for each column being returned (t[1] = first column, t[2] = second column, etc.). The following example returns one row that has three columns.
function processRow(x)
return { x, x*x, x*x*x }
end
To return several rows, return a nested table of the form:
{{row1_column1, row1_column2, ..., row1_columnX},
{row2_column1, row2_column2, ..., row2_columnX},
...,
{rowY_column1, rowY_column2, ..., rowY_columnX}}
For example, this processRow() method returns 3 rows that have 2 columns.
function processRow(x)
local rows={}
rows[1] = { 1, random(x) }
rows[2] = { 2, random(x) }
rows[3] = { 3, random(x) }
return rows
end