Converting A Query Row Into A Structure

Published: {ts '2011-11-16 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/converting-a-query-row-into-a-structure/

Recently I needed a way to convert a single query row into a structure that I could pass into a function. Google didnt turn up anything useful on the adobe site so I decided to write something myself. This is what I came up with.

Note: This code was written and tested in CF9 so I cant guarantee it will work on older versions of CF.

Convert A Single Query Row Into A Structure

This turned out to be very simple to implement. I simply looped over the column list and extracted the values of that column name from the given row number.

Convert A Query Object Into An Array Of Structures

This is a simple expansion of the previous function. This time I loop over the entire query and build up an array of strucures.

At the end of the day a change in requirements meant I did not need this code but I hope it might be helpful to somebody else.