Installation guide
WHERE LastName = ‘#EmployeeName#’ 
</CFQUERY> 
If you have code where this behavior is undesirable, you can change it with the available 
PreserveSingleQuotes() function, which when used against a variable within a 
CFQUERY will stop the automatic escaping of quotes. For example, consider an instance 
when a variable used in SQL (such as an incoming form field or other variable) may have 
a list of values presented as a single-quote delimited list. Escaping single-quotes in this 
case will produce incorrect results: 
<CFSET NameList=" 'Peterson','Smith' "> 
<CFQUERY NAME="employees" DATASOURCE="cfsnippets" > 
SELECT * FROM Employees 
WHERE LastName IN (#PreserveSingleQuotes( NameList )#) 
</CFQUERY> 
As a further enhancement, if you would like all variables within a query to automatically 
preserve any single quotes, BlueDragon 6.1 adds a new 
PreserveSingleQuotes attribute 
that can be specified on the 
CFQUERY. The new attribute simply applies a global change of 
behavior in SQL processing than might otherwise be achieved with one or more uses of 
the 
PreserveSingleQuotes() function; for example: 
<CFSET NameList=" 'Peterson','Smith' "> 
<CFQUERY NAME="employees" DATASOURCE="cfsnippets" 
 PRESERVESINGLEQUOTES=”Yes”> 
SELECT * FROM Employees 
WHERE LastName IN (#NameList#) 
</CFQUERY> 
4.4.11.2 New CacheName Attribute 
BlueDragon offers improved caching for CFQUERY tags via the new cacheName and 
action attributes. The optional cacheName attribute can be used to assign a unique name 
for cached 
CFQUERY results: 
<CFQUERY NAME=”users” DATASOURCE=”mycompany” CACHENAME=”usercache”> 
SELECT * FROM USERS 
</CFQUERY> 
In the above example, the CFQUERY results will be cached under the name “usercache” 
and when this query is run again the results from the cache will be used. You must spec-
ify a unique value for 
CACHENAME; if the same value for CACHENAME is specified for multi-
ple 
CFQUERY tags, whether on the same or different CFML pages, the results in the cache 
will be overwritten. 
The 
cachedWithin and cachedAfter attributes as implemented by ColdFusion can be 
used in conjunction with CACHENAME. 
A 
CFQUERY cache can be flushed using the new optional action attribute: 
BlueDragon 6.1 CFML Compatibility and Reference Guide    21   










