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
cfqueryorcfstoredproctag to retrieve a record set from a data source. We haven’t covered thecfstoredproctag yet; we’ll get to it in Chapter 11. For now, just be aware that the tag can return a record set just like thecfquerytag.Certain CFML tags such as
cfftpandcfhttpreturn 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 and
components to return a query result set. Custom tags are covered in
Chapter 21, components in Chapter 22. The query manipulation functions can also add additional data to an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access