Adam,


I think that it is just bad coding.  I have seen a fair amount of confusion
on the point of getting values out of a query (e.g., people often seem refer
to MyQuery.ColName without looping, unintentionally getting nothing but the
first value).  Also, I think people often don't know array notation for
queries.  I myself coded for some time before finding out about it.  If
someone were faced with the task of getting the last value from a query, I
can imagine this is how they would do it.


I'm sure you know all this, but I thought I'd add another voice saying, "I
think it's poor coding."


HTH,
Matthieu

-----Original Message-----
From: Adam Haskell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 05, 2004 8:42 AM
To: CF-Talk
Subject: looping query

Ok so I inherited an application to update and I am trying to clean it
up a little bit,or maybe a lot, but I keep running into this:

<cfloop query="MyQuery">
   <cfset revBy=MyQuery.rev_by>
   <cfset revDt=MyQuery.rev_dt>
</cfloop>

why oh why would some one do this? Is there a good explanation? Since
the code is not commented I have no idea who the original author is so
I can't ask him/her.

At the very least wouldn't

<cfset revBy = MyQuery.rev_by[myquery.recordcount]>
<cfset rev_dt = MyQuery.rev_dt[myquery.recordcount]>

Get you to the sane place faster? Most of these queries I think are
only supposed to return one row but still I would think, especially on
CF 5 which is what this app is running on, the looping would be a
waste of time. Anyone's thoughts?
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to