Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Scott Brady / Scott Brady (Scott Brady)
Created: 02/23/2015
Components: Database
Versions: 11.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: CF11_Final / CF11 Update7
Priority/Frequency: Normal / Some users will encounter
Locale/System: ALL / Mac 10.10 64 bit
Vote Count: 3
Related Bugs:
CF-3943345 - Similar to
CF-3949417 - Similar to
Problem Description:
When using queryExecute() with a SQL statement that includes an XQuery search that contains colons, the parser breaks on the colons expecting the text after the column to be a named parameter.
Steps to Reproduce:
1) Write a SQL statement that does an XQuery search. For example:
local.myQuery = queryExecute("
SELECT mt1.myColumn
FROM
myTable mt1
INNER JOIN myTable2 mt2 ON mt1.joinColumn = mt2.joinColumn.value('(form[@id=sql:column(""p.formID"")]/question[@id=sql:column(""q.formQuestionID"")]/option/@id)[1]', 'NVARCHAR(35)')
WHERE mt1.myID = :myID
",
{myID: {value:100, cfsqltype:'cf_sql_int'}},
{datasource:"myDSN"}
);
Actual Result:
An exception is returned: "Named Parameter (column) is not defined" [NOTE that it thinks :column in the XQuery is a named parameter
Expected Result:
The query would run as expected and a result set would be returned.
Any Workarounds:
Other methods of running queries (CFML's <cfquery> and cfscript's query() can be used (even though query() uses the same format for named parameters).
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3944215
External Customer Info:
External Company:
External Customer Name: Donald
External Customer Email:
External Test Config: My Hardware and Environment details:
Mac OS X (10.10) running Coldfusion 11 to connect to SQL Server 2014
Attachments:
Comments: