Qais wrote:
> Thanks for your reply, I know I can do it as
<cfoutput query= ......> but I
> have a friend which told me that if you don't scope a
column name by the name
> of the query, like query_name.column_name and this
column name just by chance
> exists as a variable in another scope (like session or
application or ...etc.)
> and with a stress test it could jump and read that other
value in the other
> scope.
>
> My understanding for CF since before until today that
when you print a query
> like
> <cfoutput query= ......>
> #column_name#
> </cfoutput>
> then CF will look into ONLY that recordset and will not
go further and make a
> search into other scopes.
If there is someone here in this forum from Adobe
> can I get a clear answer if this SHOULD scoped or
not.
>
Yes, scoping is considered a best practice. Inside an
<cfoutput...>
block, ColdFusion will look in the named query *first*, but
it does not
stop there. If the value is not found in the query, then it
will look
into other scopes in a defined and documented order.
Outside of an <cfoutput...>, i.e., in your first
example with a
<cfloop...> I suspect the query is not the first scope
looked into.
http://www.adobe.com/devnet/server_archive/articles/using_cf_variables2.html#scopes
http://www.chapter31.com/2008/03/28/evaluating-coldfusion-unscoped-query-variables/
http://www.oreillynet.com/pub/a/oreilly/web/news/coldfusion_0701.html
Not exactly a hidden secret here.