Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started
by Ben Forta, Raymond Camden, Charlie Arehart
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 ...
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