This is a message I sent this weekend but was bounced ..... I'm still
curious about structures :-)

----- Original Message -----
From: Jay Sudowski <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 21, 2000 1:48 PM
Subject: Re: Query Cache Question


> Hey Pete,
>
> Thanks for the structure example :-).  I have a few questions though -
> seeing as how the whole purpose of the structure is to avoid hitting the
> database, how would I go about outputting an entire list of products from
> the structure?  Or say, just a list of products in a certain category?  I
> guess I could query the db for just product ID's and then loop through the
> structure, but that pretty much defeats the purpose of a structure, huh?
>
> Also, in the <cfoutput> section of the code, why do you refer to the
> structure as attributes.getProductDetails?  Would it still work if I used
> application.getProductDetails ...?
>
> I've never used structures before, but its apparent they're lots more
> efficient than hitting that database again and again for the same info, so
> go easy on me, huh? <g>
>
> Thanks,
>
> Jay
>
> ----- Original Message -----
> From: Pete Freitag <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 20, 2000 2:31 AM
> Subject: RE: Query Cache Question
>
>
> > 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.
> >
>
>

------------------------------------------------------------------------------
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