Local is probably a reserved word. It turns blue in query analyser. Try
using a different name for your struct and see if that fixes it.

Adrian

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED]
Sent: 09 February 2006 21:30
To: CF-Talk
Subject: Q of Q oddity


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


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