Skip to content

Instantly share code, notes, and snippets.

@CreativeNotice
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CreativeNotice/be97c68396b3e80c84f0 to your computer and use it in GitHub Desktop.
Save CreativeNotice/be97c68396b3e80c84f0 to your computer and use it in GitHub Desktop.
An update to Nathan Dintenfass' function at http://www.cflib.org/udf/QueryToArrayOfStructures. I've removed pre CF9 support to save a couple lines.
private array function QueryToArrayOfStructures( required query theQuery ){
var theArray = [];
var cols = ListtoArray(theQuery.columnlist);
for( var row=1; row <= theQuery.recordcount; row=row+1 ){
var thisRow = {};
for( var col=1; col <= arraylen(cols); col=col+1 ){
thisRow[cols[col]] = theQuery[cols[col]][row];
}
arrayAppend(theArray, thisRow);
}
return(theArray);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment