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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson