Thursday, April 29, 2010

Coldfusion Query of Queries (QoQ) Support

QoQ is convenient, but also poorly documented. I cannot find any official Adobe documentation with details about its features and limitations. It's features changes from version to version, usually only expanding (which is a good thing). There are also many bugs, and weird restrictions.

I guess Ben Forta's books rarely touched this topic for a reason.

So generally, I can only test what can be done by trial and error, and frequently find out that although it works on my computer, but will fail in another CF host due to difference in CF server version.

A summary of what can and cannot be done in CF QoQ (aka In Memory Query).
1. Data size: recommended 5,000 - 50,000 rows, subject to computer memory size;
2. join: inner join of two tables using WHERE clause
join two tables
inner join through a WHERE clause
cross join
use these clauses: LEFT JOIN, RIGHT JOIN, OUTER JOIN
join more than two tables
3. union: supported, but can be difficult to use due to strict type matching requirements;
4. dot notation: allow access to query in a structure through dot notation;
5. conditional operators: IS, IS (NOT) NULL, >, >=, <>, !=, <, <=, ==, BETWEEN, IN, LIKE
6. case sensitivity: it is case sensitive
7. other supported T-SQL keywords: GROUP, ORDER, DISTINCT, AVG, COUNT,

Beyond QoQ:
1. features from CFQuery tag: maxRows (equivalent to TOP), blockFactor
2. features from CFOutput, CFLoop: startRow, maxRows (combined equivalent to LIMIT)

No comments: