O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 or cfstoredproc tag to retrieve a record set from a data source. We haven’t covered the 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 cfquery tag.

  • Certain CFML tags such as cfftp and cfhttp 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 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required