Query Objects
Query objects are special ColdFusion data structures that hold record sets. Query objects are similar in structure to two-dimensional arrays and are made up of rows and columns (like a spreadsheet). There are three ways to create a query object:
Using the
CFQUERY
orCFSTOREDPROC
tag to retrieve a record set from a data source. We haven’t covered theCFSTOREDPROC
tag yet; we’ll get to it in Chapter 11. For now, just be aware that the tag can return a record set just like theCFQUERY
tag.Certain CFML tags such as
CFFTP
andCFHTTP
return information stored in a query object.Query objects can be manually created using
QueryNew( )
and other associated query manipulation functions.
By this point, you should be quite familiar with the first method in
which query objects are automatically returned by the
CFQUERY
tag. The second method has to do with
certain CFML tags returning information stored as query objects.
These tags are covered in detail later in the book. We’re going
to focus on the third method in this section, creating and
manipulating query objects using QueryNew( )
and
several other CFML functions. Creating a query in this way is useful
when you want to make application-generated data available as a query
object. This technique is especially useful when used within custom
tags to return a query result set. Custom tags are covered in Chapter 19. The query manipulation functions can also add
additional data to an existing query.
To create a query object, ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.