Hey all, so I am trying to do a query or queries and am getting a very odd
behavior. I have an email bean (EmailBean) that has a query of attachments
(FilePath, DeleteAfterSending). After I send out an email (based on the
email bean) I query for files I have to delete:

<cfset var LOCAL = StructNew() />
<cfse LOCAL.Attachments = ARGUMENTS.EmailBean.GetAttachments() />

<cfquery name="LOCAL.OldFileQuery" dbtype="query">
SELECT    *
FROM    LOCAL.Attachments
WHERE   DeleteAfterSending = 1
</cfquery>


This throws an error when it parses "FROM LOCAL" in the SQL statement.
However, I have done a thousand query of queries this way and it works. The
only difference is that I am usually using a passed argument instead of a
local variable. So I tried a tweak:


<cfset var LOCAL = StructNew() />
<cfse LOCAL.Attachments = ARGUMENTS.EmailBean.GetAttachments() />

<cfset ARGUMENTS.Attachments = LOCAL.Attachments />   <!--- NEW LINE --->

<cfquery name="LOCAL.OldFileQuery" dbtype="query">
SELECT    *
FROM    ARGUMENTS.Attachments
WHERE   DeleteAfterSending = 1
</cfquery>


As you can see above, I am merely setting an arguments variable to the LOCAL
attachment value. And guess what? This parses fine and works as expected.
What is going on here? Why would ARGUMENTS scope work but not the LOCAL
"pseudo" scope within the UDF? Its this crazy or is it just me?

Thanks,
.......................
Ben Nadel 
Web Developer
Nylon Technology
350 7th Ave.
Suite 1005
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231838
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