ColdFusion Java Query Object

I'm currently refactoring some code from a client website to be used in a standalone application. I've been having some fun sorting through old legacy code, as well as some interesting ummm... code written by various past developers.

Hidden in amongst the chaff I found a slightly unusual bit of code that made me scratch my head.

In the code I was tidying up and restyling I came across this line of code

view plain print about
1<cfif getNewsCategories.IsLast()>

"getNewsCategories" is a poorly named CFQuery result set with a function call of "isLast()" on the end of it. This confused me because this site is a pre-ORM style site, so there's no Transfer-ORM or ColdFusion 9 Hibernate in there and the rest of the time the query is accessed normally.

A quick scout around dug up this article about undocumented ColdFusion QueryTable feature. Scanning down through the article I eventually came to a reference to the actual java class in ColdFusion and the java classes it extends.

I knew this, honest I did, but I'd forgotten. ColdFusion QueryTable extends javax.sql.RowSet which has all sorts of methods that it inherits from java.sql.ResultSet which include isFirst() and isLast().

I haven't played with any of the other methods, but I thought it was something fun to play with at some point and thought I'd run up this quick blog post to remind myself if nothing else.

That is pretty interesting. Do you know if those classes are still available in new versions of Coldfusion?
# Posted By Dave Long | 6/27/11 2:07 PM
They should be. The server that I'm running this code against at the minute is ColdFusion 8. I don't believe QueryTable has changed that much between 8 and 9. Also, I can't see it deviating from being an extended version of java's ResultSet and RowSet objects in a hurry.
# Posted By Stephen Moretti | 6/27/11 2:25 PM