Created
March 2, 2010 09:11
-
-
Save acotie/319371 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="QueryToStructArray" access="private" returntype="array" output="no" hint="convert to Array of query to Struct."> | |
<cfargument name="query" type="query" required="yes"> | |
<cfargument name="rownum" type="numeric" default="1"> | |
<cfset var local = StructNew()> | |
<cfset local.result = ArrayNew(1)> | |
<cfif arguments.query.RecordCount gte 1> | |
<cfloop index="local.i" from="1" to="#arguments.query.RecordCount#"> | |
<cfset local.obj = createObject("component","componentFile")> | |
<cfloop index="local.col" list="#arguments.query.ColumnList#"> | |
<cfset local.obj[local.col] = arguments.query[local.col][local.i]> | |
</cfloop> | |
<cfset local.result[local.i] = local.obj> | |
</cfloop> | |
</cfif> | |
<cfreturn local.result> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment