Russ,

>So to fix this do I have to do something like this:
>
><cfset var thisQry="">
><cfquery name="thisQry" datasource"somedsn">
>Select somestuff from somewhere
></cfquery>
><cfreturn thisQry>
>
>Is there a way to avoid the cfset and put it directly in the cfquery?  Such
>as something like this:
>
><cfquery name="var thisQry">

As Isaac said, not currently. One practice I've seen some developers using
is to declare a new struct called "local" and they use that as a
pseudo-scope for keeping variables locally scoped to a function. I've tried
using this technique and haven't decided whether I like it or not.

So, for example:

<!---// at the top of your function //--->
<cfset var local = structNew()>

<!---// now later when you want to declare a variable or query //--->
<cfset local.someVar = "test">

<cfquery name="local.html" datasource="local.dsn">
</cfquery>

I've used a technique like the "local" struct method for throw away
variables in the past (i.e. stuff I'm using in order to just help
w/readability.) You just have to make sure that if you use a technique like
"local" that you make sure to always declare you "variables" as keys in that
structure or else you're liable for race conditions again.

-Dan



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211034
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to