Copy link to clipboard
Copied
OR is it just some really strange 'feature'.
IS it just me or should not both of these work?
WORKING CODE
<cfset reports = [
{name="Reneawal Date before Issue Date",sql="RenewDate < IssueDate"},
{name="Expiration Date before Renewal Date",sql="ExpirationDate < RenewDate"},
{name="Expiration Date before Issue Date",sql="ExpirationDate < IssueDate"},
{name="Not Fly Anomolies",sql=""},
{name="Expiration Date NOT December 31st",sql="DAY(ExpirationDate) != 31 OR MONTH(ExpirationDate) != 12"}
]><cfset variables.sql = reports[1].sql>
<cfquery ...>
SELECT aField, bField, cField
FROM aTable
WHERE #preserveSingleQuotes(variables.sql)#
</cfquery>
FAILING CODE
<cfset reports = [
<cfquery ...>
{name="Reneawal Date before Issue Date",sql="RenewDate < IssueDate"},
{name="Expiration Date before Renewal Date",sql="ExpirationDate < RenewDate"},
{name="Expiration Date before Issue Date",sql="ExpirationDate < IssueDate"},
{name="Not Fly Anomolies",sql=""},
{name="Expiration Date NOT December 31st",sql="DAY(ExpirationDate) != 31 OR MONTH(ExpirationDate) != 12"}
]>SELECT aField, bField, cField
FROM aTableWHERE #preserveSingleQuotes(reports[1].sql)#
</cfquery>
Complex constructs are not supported with function
preserveSingleQuotes
Use simple variable instead
Message was edited by: ilssac Ok, after some thought, and a closer reading of the error message, maybe not a true bug or feature, but it still strikes me as a rather strange limitation requirement of the function.
Copy link to clipboard
Copied
Yes, they should both work. But there are a few places where variables are not interchangeable as you'd expect them to be. I'd file a bug report and move on.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
Done and done.
Copy link to clipboard
Copied
Which version of CF?
CF8 was a abit flaky with the short-form struct / array notation, which was mostly fixed in CF9. But only mostly: it still has idiosyncrasies.
What if you used more traditional function-based-code to define your array/structs?
--
Adam
Copy link to clipboard
Copied
Adam Cameron. wrote:
Which version of CF?
CF 9.0.0
Someday they will hopefully apply the updater here!
Adam Cameron. wrote:
What if you used more traditional function-based-code to define your array/structs?
I don't know. I might give that a try somday, but not right now, 6 minuters before "Pub" time as I beleive you call it.