This is a good example of a query not to cache this way, let me explain
why...
Your idea with the dynamic query name shows that you have an idea why this
might not work. It will cache the query in memory with the value that you
first executed it with.  Keep in mind that cold fusion can only have 100
queries cached at once, so you don't want to use them all up in one place.

Here's how I would solve your situation...
<cfif NOT IsDefined("Application.getProductDetails")>
        <cfquery name="getProductDetails" datasource="xyz">
                SELECT * FROM Product
        </cfquery>
        <cfset application.getProductDetails = ArrayNew(1)>
        <cfoutput query="getProductDetails">
                <cfset application.getProductDetails[Pdt_ID] = StructNew()>
                <cfset application.getProductDetails[Pdt_ID].ProductName = ProductName>
                <cfset application.getProductDetails[Pdt_ID].Price = Price>
                <cfset application.getProductDetails[Pdt_ID].fieldname = fieldname>
                <cfset application.getProductDetails[Pdt_ID].etc = etc>
                <!--- include all the fieldnames for your table --->
        </cfoutput>
</cfif>

Now you can refer to a field based on your primary key, like this...

<cfoutput>#attributes.getProductDetails[Attributes.PdtID].Price#</cfoutput>


_______________________________________________
Pete Freitag
CFDEV.COM
Cold Fusion Developer Resources
http://www.cfdev.com/

-----Original Message-----
From: Ken M. Mevand [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 20, 2000 2:01 AM
To: 02 cf-talk
Subject: Query Cache Question


lets say i have a query :

<CFQUERY NAME="getProductDetails" DATASOURCE="xyz"
CACHEWITH="#CreateTimeSpan(0,1,0,0)#">
    SELECT * FROM Product WHERE Pdt_ID = #Attributes.PdtID#
</CFQUERY>

thus, for every product request, this query will be recached since the query
statement will be different. would it be better to rename the query to
something like NAME="getProductDetails_#Attributes.PdtID#" instead?

thanks


----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to