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

Name

cfquery

Synopsis

<cfquery>
  [<cfqueryparam>]
SQL statements
</cfquery>

Performs SQL operations against a data source or existing query object. In ColdFusion MX, SQL reserved words can no longer be used as column or query names. When building dynamic queries from form or URL parameters, Macromedia recommends always binding the parameters with cfqueryparam tags.

Attributes

name=" query_name "

Name to assign to the query. Valid query names must begin with a letter, underscore, or Unicode currency symbol ($) and can contain only letters, numbers, underscores, and Unicode currency symbols. Required when passing an SQL select statement; optional for all other SQL operations. Although the name attribute is required only for SQL select statements, you may wish to use it in all your queries. It makes debugging easier, especially for templates that contain multiple queries, because it allows you to identify each query by name in the debugging output.

datasource=" datasource_name "

The name of the data source to connect to when executing the query. Required except when dbtype is Query or Dynamic.

blockfactor=" block_size "

The maximum number of rows to retrieve from the server at a time. Optional. The range is from 1 to 100; 1 is the default. Note that some drivers may reduce the block factor automatically.

cachedafter=" date "

A date for using cached query data. Cached query data is used only if the date of the original query is after the date specified in CACHEDAFTER. To use cached ...

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