ColdFusion Java Query Object
Originally Posted At : June 27, 2011 12:45 PM on nil.checksite.co.ukI'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
"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.