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:
CFSTOREDPROC tag to
retrieve a record set from a data source. We haven’t covered
CFSTOREDPROC 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 the
Certain CFML tags such as
CFHTTP return information stored in a query
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, ...