querySetRow

Adds a row to a query, either by struct or array

querySetRow(query, [rowNumber,] rowData) → returns boolean

Member Function Syntax

someQuery.setRow([rowNumber,] rowData)

This function requires Lucee 5.3.8 and up.  Not supported on Adobe ColdFusion, etc.

querySetRow Argument Reference

query query
Required

The query object on which to set the row

rowNumber numeric
Default: 0

Position of the row to be updated. If not provided or set to 0, a new row is added.

rowData any
Required

A struct or array containing the row data

Examples
Sample code invoking the querySetRow function

Sets third row of query overwriting news entry

news = queryNew("id,title", "integer,varchar", [{"id"=1,"title"="Dewey defeats Truman"},{"id"=2,"title"="Men walk on Moon"},{"id"=3,"title"="Nixon Resigns"},{"id"=4,"title"="The Berlin Wall falls"}]);
querySetRow(news, 3, {"id"=5,"title"="The internet is born"});
writeDump(news);

Sets third row of query overwriting news entry

news = queryNew("id,title", "integer,varchar", [{"id"=1,"title"="Dewey defeats Truman"},{"id"=2,"title"="Men walk on Moon"},{"id"=3,"title"="Nixon Resigns"},{"id"=4,"title"="The Berlin Wall falls"}]);
news.setRow(3, {"id"=5,"title"="The internet is born"});
writeDump(news);

Fork me on GitHub