I offered my reply before seeing yours here, Derrick. Doh. But thanks for
the confidence that I'd have something to offer. :-) 

As to your last point, I don't know. I mean, sure, those who move to more
OO-like development will tend to consider options where query results are
generated in a CFC method, and in that case they may return the results in
"an actual structure of some kind (list, array, structure)", as you say, but
I don't know about asserting that it's "always better". More of a case of
different strokes, in my experience. :-) But I get your drift.

 

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Derrick Peavy
Sent: Thursday, February 04, 2010 10:00 AM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Query or Stored Proc calling

 

Ajas:

 

I am not an expert on how CF actually executes, but I am pretty darn sure
that the assumption you have is wrong.

 

<cfoutput>getSomething.col1 <br /> getSomething.col2 <br />
getSomething.col3 <br /> </cfoutput>

 

Is not re-executing the query. Once the query is run once, assuming the
query is not in a loop itself, then it's done. It only runs once.

 

If the original coder found that there was always only a single record, then
there is no harm in the code you have. However, it's not great practice.

 

If there is any chance of ever having more than one record from that query
then your first code snip is best (<cfoutput query="getSomething"> col1 <br
/> col2 <br /> col3 <br /> </cfoutput>), and in general, is a better idea.

 

I'm sure that Charlie or someone else can chime in on how CF handles the
record set in memory and how it's referenced, etc., My guess would be that
it's always better to use structured code or an actual structure of some
kind (list, array, structure) to reference multiple record within a query. I
think the question is also similar to the old, which is better, CFLOOP or
CFOUTPUT.

 


_____________________

Derrick Peavy

 




-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to