CFLib.org – Common Function Library Project

isCachedQuery(queryname)

Last updated February 11, 2005

author

Qasim Rasheed

Version: 1 | Requires: CF6 | Library: DataManipulationLib

Description:
This UDF make use of service Factory to check wehther the queryname passed was run as a cached query.

Return Values:
Returns a boolean.

Example:

<cfquery name="test" cachedwithin="#createtimespan(0,0,1,0)#">
your query...
</cfquery>

<cfset isCached = isCachedQuery( 'test' )>

Parameters:

Name Description Required
queryname Name of query to check. Yes

Full UDF Source:

<!---
 Return true if the queryname passed was a cached query.
 
 @param queryname 	 Name of query to check. (Required)
 @return Returns a boolean. 
 @author Qasim Rasheed (qasimrasheed@hotmail.com) 
 @version 1, February 11, 2005 
--->
<cffunction name="isCachedQuery" returntype="boolean" output="false">
	<cfargument name="queryname" required="true" type="string" />
	
	<cfset var events = "">
	<cfset var result = false>	
	<cfset var temp = "">
	
	<cfif isdebugmode()>
		<cfset events = createobject('java','coldfusion.server.ServiceFactory').getDebuggingService().getDebugger().getData()>
		<cfquery name="temp" dbtype="query">
			select	cachedquery
			from	events
			WHERE 	type='SqlQuery' 
					and name='#arguments.queryname#'
		</cfquery>
		<cfset result = yesnoformat(temp.cachedquery)>
	</cfif>

	<cfreturn result />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson