Akbarsait's Blog

Using cachedWithin/cachedAfter in CFQUERY with CFQUERYPARAM

Earlier morning, I was working on creating a cached query for to display Next N record-navigation interface. I'm having the ColdFusion 8 installed in my system. The below query with CFQUERYPARAM executes well and my aim of displaying Next N record-navigation is achieved.

<cfquery name="qBlogFeedResult" datasource="#application.dsn#" cachedwithin="#createTimeSpan( 0,0,30,0 )#">
select *
from blogfeed
where datecreated > <cfqueryparam value="#attributes.date#" cfsqltype="cf_sql_timestamp">
order by datecreated desc
</cfquery>

When testing this query in my other system having ColdFusion 7 installed I got the below error because CF 7 will not allow of using cfqueryparam in cfquery with cachedWithin/cachedAfter.

Using "cachedWithin" or "cachedAfter" in CFQUERY with CFQUERYPARAM is not allowed.

The great news is ColdFusion 8 allows cachedWithin/cachedAfter in cfquery with cfqueryparam and this is one of the hidden gems of ColdFusion 8. But in CF8 documentation which is not having the updated information about this functionality.

To explore more about CF 8 Hidden Gems please check Charlie Arehart's presentation on Hidden Gems in ColdFusion 8 PDF and his recorded Adobe Connect Presentation.



About Me

ColdFusion Enthusiast, Web Developer and Consultant, Travel, Technology, Android, Xbox, Movies and Music Fan boy. more
Akbarsait's Blog RSS Feed Twitter Google Plus Facebook Twitter Facebook
        My WishList


  ColdFusion 9 Tutorials    MySql Backup and FTP



  


Archives

Aggregated by

 Aggregated by ColdFusionBloggers
 Aggregated by MXNA
 Aggregated by CFBLOGS.COM