queryAddRow

Adds a specified number of empty rows to a query.

queryAddRow(query [, number]) → returns Numeric

Argument Reference for the queryAddRow function

query

Required: Yes

number/row(s)

Required: No
As of CF 10+ you can pass a Structure whose keys map to the query column names to insert a row of data; or an Array of those Structures to insert multiple rows at once.

Examples sample code invoking the queryAddRow function


Builds a simple query using queryNew and queryAddRow

CF 10+ Pass in row data directly to queryAddRow argument.

news = queryNew("id,title", "integer,varchar");
queryAddRow(news, {"id"=1,"title"="Dewey defeats Truman"});
writeDump(news);

Builds a simple query using queryNew queryAddRow and querySetCell

Using Script with the queryAddRow querySetCell functions to populate the query.

news = queryNew("id,title", "integer,varchar");
queryAddRow(news);
querySetCell(news, "id", "1");
querySetCell(news, "title", "Dewey defeats Truman");
queryAddRow(news);
querySetCell(news, "id", "2");
querySetCell(news, "title", "Men walk on Moon");
writeDump(news);

Fork me on GitHub