`
<cfquery> is the primary method of executing database queries and query-of-queries (QoQ) in ColdFusion/CFML. The <cfquery> tag's more common attributes include:
- name - The name by which the query will be referred in code.
- datasource - The data source against which the query is to be executed. Conflicts with
dbtype. - dbtype - Used with a value of
queryfor query-of-queries (QoQ) and with a value ofhqlfor ORM. Conflicts withdatasource. - cachedwithin - The time span for which the query results should be cached. Note: ColdFusion caches queries according to the name and text of the query; if either changes, the query will not be cached.
- maxrows - The maximum number of rows to be returned from the query. Use
-1to return all rows. Note: This does not affect caching (seecachedwithinabove); ifmaxrowsis changed on a cached query, the query will still return the number of rows returned when it was first cached. - timeout - The number of seconds ColdFusion should wait before timing out the query. If
<cfsetting requesttimeout="*xxx*" />is used, will override that value if the timeout specified for the query is used.
Also see: qoq coldfusion hql
(Please see the tag's documentation for additional attributes and their explanation.)