I've been meaning to ask ...
what's more efficient, generally ... a stored procedure or a cached
query?
Also, for Joshua's question ... would a stored procedure be a better
alternative than a cached query, so that he gets faster execution, but
maintains his dynamic needs?
H.
> -----Original Message-----
> From: Joshua Miller [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 16, 2003 10:25 AM
> To: CF-Talk
> Subject: Query Caching Question
>
> Ok, I've been reading up on query caching today and I think I've run
> into something that may cause me problems unless there is a way to
> dynamically name queries.
>
> I have an application that houses data for multiple "sites" - the data
> is referenced by a siteID that is set as a session variable.
>
> So for example:
>
> <cfquery datasource="#request.dsn#" name="qGetSite">
> SELECT sitename
> FROM tblSites
> WHERE siteID=#session.siteID#
> </cfquery>
>
> If I try to cache this query, then if someone logs in with a siteID of
> 20 then they'll get their data, unless the query is cached, then they'll
> get the data of whoever logged in the last time - no matter what their
> siteID correct?
>
> Is there a way to create a dynamic queryname?
>
> I tried: <cfquery datasource="#request.dsn#"
> name="qGetSite#session.siteID#"> and it worked to create the query, but
> for subsequent references I'm getting errors like on:
>
> This errors: <cfif qGetSite#session.siteID#.recordcount GT 0>
> This errors: <cfset queryct="qGetSite#session.siteID#.recordcount">
> <cfif evaluate(queryct) GT 0>
>
> Is there a way I can dynamically name my query so that I can use query
> caching without giving users the wrong data?
>
> Can I turn off all query caching and then specify queries to cache using
> the CACHEDWITHIN statement for queries that don't rely upon the siteID?
>
> Thanks,
>
> Joshua Miller
> Head Programmer / IT Manager
> Garrison Enterprises Inc.
> www.garrisonenterprises.net <http://www.garrisonenterprises.net/>
> [EMAIL PROTECTED]
> (704) 569-9044 ext. 254
>
> ************************************************************************
> *************
> Any views expressed in this message are those of the individual sender,
> except where the sender states them to be the views of
> Garrison Enterprises Inc.
>
> This e-mail is intended only for the individual or entity to which it is
> addressed and contains information that is private and confidential. If
> you are not the intended recipient you are hereby notified that any
> dissemination, distribution or copying is strictly prohibited. If you
> have received this e-mail in error please delete it immediately and
> advise us by return e-mail to
> <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
> ************************************************************************
> *************
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4