Skip to content

Instantly share code, notes, and snippets.

@acotie
Created February 26, 2010 03:18
Show Gist options
  • Save acotie/315355 to your computer and use it in GitHub Desktop.
Save acotie/315355 to your computer and use it in GitHub Desktop.
<cffunction name="QueryToStruct" access="private" returntype="struct" output="no" hint="I convert a row of a query to a struct.">
<cfargument name="query" type="query" required="yes">
<cfargument name="rownum" type="numeric" default="1">
<cfset var result = StructNew()>
<cfloop index="col" list="#query.ColumnList#">
<cfset result[col] = query[col][rownum]>
</cfloop>
<cfreturn result>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment