Undocumented Query Methods in ColdFusion MX

August 20, 2002

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 have put together a web site called ColdFusion MX Un-Documentation that has some examples of how to use these features.

4 people found this page useful, what do you think?


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
(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
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

Post a Comment


Spell Checker by Foundeo

Recent Entries


did you hack my cf?