Pete Freitag Pete Freitag

Undocumented Query Methods in ColdFusion MX

Published on August 20, 2002
By Pete Freitag
coldfusion

I found some undocumented methods that you can perform on a query by using Java Reflection. The methods are summarized here:
void query.first() - jump to the beginning of a query
void query.last() - jump to the last value in a query
boolean query.isFirst() - true if we are looking at the first row
boolean query.isLast() - true if we are looking at the last row
boolean query.next() - jump to the next row
boolean query.previous() - jump to the previous row
int findColumn(String name) - get the id of a column by name
void sort(int columnId, boolean ascending) - sort by a column
int getColumnCount() - returns the number of columns
String getColumnTypeName(int columnId) - gets the data type of a column,
	this one didn't work properly when I tested it, it would return
	NUMERIC for a field that was a varchar. There is a method called
	guessColumnType that was probably used to determine it, it guessed wrong.

I had put together a web site called ColdFusion MX Un-Documentation that has some examples of how to use these features. Update: no longer avaliable

Undocumented Query Methods in ColdFusion MX was first published on August 20, 2002.

FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.

CFBreak
The weekly newsletter for the CFML Community


Comments

has the sort() method been disabled/removed in 6.1? Appears so...

Got the following:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code
by Rich Zaide on 04/02/2004 at 11:08:20 AM UTC
(a blast from the past)
well CF7 has just been released and these "features" are *still* undocumented!

which is a shame because all they do is provide the same sort of functionality that I used to use with ASP/ADO six years ago!

CFQUERY is CF's weakest link. with feature rich asp.net there's some catching up to do...

my 2c
barry.b
by barry.b on 02/07/2005 at 7:30:28 AM UTC
This sounds really useful! Is it still applicable for CF8/9? I looked at your linked examples but couldn't find anything that explained how to implement the idea. Do you have a simple, self-contained, example you can share/blog?

TIA
by dickbob on 07/28/2009 at 9:20:38 AM UTC