OpenBD Wiki

From OpenBD
Jump to: navigation, search

CFQUERY

CFQUERY now supports a result variable which includes the ID of an inserted row. (Need to add details.)

Contents

Enhancements

Query Caching

Open BlueDragon adds a CACHENAME attribute to the CFQUERY tag that can be used to assign a unique name to a cached query. This allows for much easier flushing of specific queries from the cache.

<cfquery name="myQuery" datasource="myDSN" cachename="myCacheName">
SELECT * FROM my_table
</cfquery>

The CACHEDWITHIN and CACHEDAFTER attributes may be used in conjunction with CACHENAME to add time-based caching to the named cache.

CFQUERY in Open BlueDragon also adds an ACTION attribute to facilitate flushing of named caches.

The following flushes a cached query named "myCacheName":

<cfquery action="flushcache" cachename="myCacheName">

All queries may be flushed from the cache using the FLUSHALL action:

<cfquery action="flushall">

Note that the flush action can be used anywhere; it does not need to appear on the same CFML template on which the query was cached.

Open BlueDragon also supports the use of CFOBJECTCACHE for flushing cached queries, but adds a CACHEDOMAIN attribute for clearing caches on multiple servers.

BACKGROUND Attribute

Open BlueDragon allows use of a BACKGROUND attribute with CFQUERY. When BACKGROUND is set to TRUE, the query is run in a background thread and processing does not wait for the query to complete before continuing.

This differs slightly than using CFTHREAD to run a query. When the BACKGROUND attribute is used, a single background thread is used for all background operations, and the background operations are queued. When CFTHREAD is used a new thread is spawned.

Two log files are kept to track the progress of these queries.

  • querybatch.log - for successful executions
  • querybatch-errory.log - for exceptions and errors, printing out the SQL statement of the problem

EXECUTIONTIME Variable

The variable EXECUTIONTIME is available on query objects, e.g. myQuery.executiontime.

PRESERVESINGLEQUOTES Attribute

To allow global control over whether or not single quotes are preserved (as opposed to automatically escaped) within an entire query.

<cfquery name="myQuery" datasource="myDSN" preservesinglequotes="true">
...
</cfquery>

Slow Log

This tag supports the slow log featureset.

Unsupported Features

"DSN-less" connections with CFQUERY are not supported. This feature is also not supported in versions of ColdFusion newer than version 5.


Personal tools