tracker issue : CF-3326717

select a category, or use search below
(searches all categories and all time range)
Title:

Bug with parameter parser in Query.cfc

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 09/07/2012

Components: Language, Script CFC

Versions: 9.0.1

Failure Type:

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win XP All

Vote Count: 0

Problem Description:
See http://adamcameroncoldfusion.blogspot.co.uk/2012/09/not-obvious-bug-in-querycfc.html.

In short: if the SQL statement passed to Query.cfc has a hard-coded timestamp (or any other similar bit of data) in it, CF interprets the  minutes and seconds part of the timestamp as parameter names

Steps to Reproduce:
<cfprocessingdirective pageencoding="UTF-8">
<cfscript>
    q1 = queryNew("");
    queryAddColumn(q1, "id", [1,2,3,4,5,6,7]);
    queryAddColumn(q1, "daysofWeek", ["R?hina","R?t?","R?apa","R?pare","R?mere","R?horoi","R?tapu"]);
    queryAddColumn(q1, "ts", [now(),now(),now(),now(),now(),now(),now()]);

    o = new Query(
        dbtype    = "query",
        sql        = "
            SELECT    *
            FROM    q1
            WHERE    ts = '#now()#'
        "
    );

    o.setAttributes(q1=q1);

    o.execute();
    q2 = o.getResult();

    writeDump(variables);
</cfscript>

Actual Result:
Error Executing Database Query
Parameter '45' not found in the list of parameters specified

SQL: SELECT * FROM q1 WHERE ts = '{ts '2012-09-07 08:45:06'}'

Expected Result:
Not an error

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3326717

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

BELAY THIS. It's a case of PEBKAC. See update to http://adamcameroncoldfusion.blogspot.co.uk/2012/09/not-obvious-bug-in-querycfc.html
Comment by External U.
18150 | September 07, 2012 03:55:22 AM GMT
It seems to be working fine, I do not use single quotes around #Now()#.
Comment by Nimit S.
18151 | December 17, 2013 04:45:56 AM GMT