initial
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<cfif thisTag.ExecutionMode is 'end'>
|
||||
<cfparam name="ATTRIBUTES.output" type="string">
|
||||
<cfparam name="ATTRIBUTES.outputType" type="string" default="map">
|
||||
<cfparam name="thisTag.params" type="array"/>
|
||||
|
||||
|
||||
<cffunction name="paramTypeToColumnType">
|
||||
<cfargument name="paramType" type="string"/>
|
||||
|
||||
<cfswitch expression=#ARGUMENTS.paramType#>
|
||||
<cfcase value="integer">
|
||||
<cfreturn "integer"/>
|
||||
</cfcase>
|
||||
<cfcase value="numeric">
|
||||
<cfreturn "decimal"/><!---*** --->
|
||||
</cfcase>
|
||||
<cfcase value="datetime">
|
||||
<cfreturn "timestamp"/>
|
||||
</cfcase>
|
||||
<cfcase value="string">
|
||||
<cfreturn "varchar"/>
|
||||
</cfcase>
|
||||
<cfdefaultcase>
|
||||
<cfreturn "varchar"/>
|
||||
</cfdefaultcase>
|
||||
</cfswitch>
|
||||
</cffunction>
|
||||
|
||||
|
||||
|
||||
<cfswitch expression=#ATTRIBUTES.outputType#>
|
||||
|
||||
<cfcase value="map">
|
||||
<cfloop from=1 to=#arrayLen(thisTag.params)# index="i">
|
||||
<cfset "CALLER.#ATTRIBUTES.output#.#thisTag.params[i].name#"=thisTag.params[i].value/>
|
||||
</cfloop>
|
||||
</cfcase>
|
||||
|
||||
<cfcase value="query">
|
||||
<cfset columnList=""/>
|
||||
<cfset columnTypeList=""/>
|
||||
<cfloop from=1 to=#arrayLen(thisTag.params)# index="i">
|
||||
<cfset columnList=listAppend(columnList, thisTag.params[i].name)/>
|
||||
<cfset columnTypeList=listAppend(columnTypeList, paramTypeToColumnType(thisTag.params[i].type))/>
|
||||
</cfloop>
|
||||
<cfset qOut=queryNew(columnList,columnTypeList)/>
|
||||
<cfset queryAddRow(qOut)/>
|
||||
<cfloop from=1 to=#arrayLen(thisTag.params)# index="i">
|
||||
<cfset querySetCell(qOut, thisTag.params[i].name, thisTag.params[i].value)/>
|
||||
</cfloop>
|
||||
<cfset "CALLER.#ATTRIBUTES.output#"=#qOut#/>
|
||||
</cfcase>
|
||||
|
||||
<cfdefaultcase>
|
||||
<cfthrow type="custom" message="Unsupported output type '#ATTRIBUTES.outputType#'" detail=""/>
|
||||
</cfdefaultcase>
|
||||
|
||||
</cfswitch>
|
||||
</cfif>
|
||||
Reference in New Issue
Block a user