Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Clifton Johnston / Clifton Johnston ()
Created: 02/08/2017
Versions: 2016,11.0
Failure Type: Others
Found In Build/Fixed In Build: ColdFusion 11 Update 10 / 303807
Priority/Frequency: Normal /
Locale/System: / Win 2008 Server R2 64 bit
Vote Count: 2
Problem Description: This error occurs when the SQL statement includes literal strings (enclosed in single quotes) containing a colon (:) followed by a space.
Steps to Reproduce: Example code:
qGetEmailTemplate = queryExecute("
SELECT Introduction, Subject, EmailBody, FromAddress, ActionType
FROM Templates
WHERE Title = 'Customer Support: Something or Other'
AND Active = 1
",{},
{
datasource = Request.ds
});
Actual Result: Error received: "Error occurred while parsing SQL query string. Space is not allowed after parameter prefix ':'"
Expected Result: No error, and possibly, records returned, etc. CF shouldn't be attempting to parse for parameters within the string literals.
Any Workarounds: Replacing the string literal with an actual parameter holding the value of the string literal works:
qGetEmailTemplate = queryExecute("
SELECT Introduction, Subject, EmailBody, FromAddress, ActionType
FROM Templates
WHERE Title = :emailTitle
AND Active = 1
",{ emailTitle = 'Customer Support: Something or Other' },
{
datasource = Request.ds
});
Attachments:
Comments: