Lucee vs Adobe ColdFusion columnList vs getColumnList vs getmetadata
I have a general section which dynamically displays reports, which are preconfigured in a certain way.
There are some totals and data rows which are not part of the metrics so net result is I had some CF code looking at the column lists and displaying appropriately.
Turns out there are very different results between Lucee and Adobe Coldfusion, for this example, it's important to create a sample table like so:
CREATE TABLE testtable(
[Col1] [varchar](50) NULL,
[ACol2] [varchar](50) NULL
)
so that ACol2 is actually alphabetically before Col1.
Then run this
<cfquery datasource="aTestDSN" name="qry">
select * from testtable
</cfquery>
<cfset columns = "">
<cfloop array="#getmetadata(qry)#" item="aryItem">
<cfset columns = listappend(columns, aryItem.Name)>
</cfloop>
<table>
<tr><td>getmetadata</td><td><cfoutput>#columns#</cfoutput></td></tr>
<tr><td>ColumnList</td><td><cfoutput>#qry.ColumnList#</cfoutput></td></tr>
<tr><td>arrayToList(qry.getColumnList())</td><td><cfoutput>#arrayToList(qry.getColumnList())#</cfoutput></td></tr>
</table>
getmetadata | Col1,ACol2 | |||||
ColumnList | COL1,ACOL2 | |||||
arrayToList(qry.getColumnList()) Adobe Coldfusion Output:
|
Comments
Post a Comment