Skip to main content
Participant
August 6, 2014
Answered

Bug in CF11 regarding Query of queries syntax?

  • August 6, 2014
  • 1 reply
  • 1486 views

So I have decided to try CF11 because of an official outstanding CF10 bug.

Once I installed CF11, I get an error when running code like this:

<cfquery name="LOCAL.stat_questions" datasource="#APPLICATION.dsn#">

     SELECT     survey_questionID

     FROM     tbl_survey_questions

     ;

</cfquery>

<cfset LOCAL.this_statID = 1>

<cfquery name="LOCAL.subset" dbtype="query">

     SELECT     survey_questionID

     FROM          [LOCAL].stat_questions

     WHERE     survey_questionID = <cfqueryparam cfsqltype="cf_sql_numeric" value="#LOCAL.this_statID#">

     ;

</cfquery>

The error I receive is: "Query Of Queries syntax error.
  Encountered ";. "

If I remove the semi-colon... No error! Is this a bug, or was the semi-colon always bad, but just ignored?

Thanks


This topic has been closed for replies.
Correct answer Anit_Kumar

Here is the Bug#3779331 - Query of Query and SQL statements ending in semicolon

Regards,

Anit Kumar

1 reply

Anit_Kumar
Community Manager
Anit_KumarCommunity ManagerCorrect answer
Community Manager
August 6, 2014
Legend
August 8, 2014

Hmmm. Learn something new everyday. When I read the issue my initial thought was that the semi-colon was a syntax error in the query string. I have never seen nor needed this in a CF query before. But since the bug link acknowledges it's a bug, I guess the semi-colon is valid. Just for clarification, can someone tell me why it would be used (since in this example the use is superfluous)?

Participant
August 8, 2014

I just always put it in out of habit from typing out actual MySQL queries (non QoQ). Never was a problem and I always did it. Now running CF11... it requires fixing. Thought it was strange.

I actually didn't even notice that the semi-colons weren't required in QoQ until I ran into this CF11 bug. I also notice the semi-colon isn't necessary for a MySQL query either in cfquery! Seems weird that it accepts them, but isn't required. Just ignores them?