Calling Array Functions on ColdFusion Query Columns Part II
Posted July 26, 2006 at 9:04 AM
The other day I had mentioned that someone posted a great tip about running ColdFusion array functions on query columns. After some testing I had come across the fact that column notation made a huge difference. For example,
Launch code in new window » Download code as text file »
- <cfset flSum = ArraySum( qGirls[ "weight" ] ) />
... works, but the following,
Launch code in new window » Download code as text file »
- <cfset flSum = ArraySum( qGirls.weight ) />
... throws an error. To investigate, I tried dumping out the Java classes that were representing these objects underneath:
Launch code in new window » Download code as text file »
- <!--- Dump out java class name. --->
- <cfdump var="#qGirls.weight.GetClass().ToString()#" />
-
- <!--- Dump out java class name. --->
- <cfdump var="#qGirls[ 'weight' ].GetClass().ToString()#" />
It turns out that both of these ColdFusion objects are the java class "coldfusion.sql.QueryColumn". This means that on the Java side of the universe they are the same object. I don't understand exactly how ColdFusion is built on top of Java, but I guess the problem here lies in ColdFusion, before anything gets cast to Java? No idea.
Download Code Snippet ZIP File
Post Comment | Ask Ben | Other Searches | Print Page
Reader Comments
There are no comments posted for this web log entry.




