Understanding Dynamic SQL

Before you actually perform a search, take a closer look at the template in Listing 12.16. The <cfquery> tag is similar to the one you used in the previous search template, but in this one the SQL SELECT statement in the SQL attribute is incomplete. It doesn’t specify a WHERE clause with which to perform a search, nor does it specify a search order. No WHERE clause is specified because the search screen has to support not one, but four search types, as follows:

  • If none of the three search fields is specified, no WHERE clause should be used, so that all movies can be retrieved.

  • If a movie title is specified, the WHERE clause must filter data to find only movies containing the specified title text. For example, if the ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.