Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unused-local-variable ignores variable usage inside of <cfquery> (QoQ) #153

Closed
sjmatta opened this issue Apr 12, 2016 · 4 comments
Closed

Comments

@sjmatta
Copy link
Contributor

sjmatta commented Apr 12, 2016

I get an "unused-local-variable" warning for "getWorkOrder" even though it is used in the Query of Queries:

<cffunction name="getSiteWorkOrders" output="no" returntype="query">
  <cfset var getWorkOrder = "" />
  <cfquery name="getWorkOrder" datasource="#application.workOrderDS#">
    SELECT * FROM WORKORDER WHERE SITEID='123' AND LOCATION='1234' AND WONUM='1'
  </cfquery>

  <cfset var qoqGetWorkOrder = "" />
  <cfquery name="qoqGetWorkOrder" dbtype="query">
    SELECT * FROM getWorkOrder
  </cfquery>

  <cfreturn qoqGetWorkOrder />
</cffunction>

<cfdump var="#getSiteWorkOrders()#" />

Local variable getWorkOrder is not used in function getSiteWorkOrders, consider removing it. (line 2, column 3)

@ryaneberly
Copy link
Contributor

Looks like this is already fixed in the dev branch.

@ryaneberly
Copy link
Contributor

@zspitzer
Copy link

I'm getting UNUSED_LOCAL_VARIABLE

Local variable q_two is not used in function testQuery, consider removing it.

<cffunction name="testQuery" access="public" returntype="any" output="false"> <CFargument name="event" type="any"> <cfscript> var q_one = queryNew("id,name", "integer,varchar"); var q_two = queryNew("id,name", "integer,varchar"); var q_three = ""; </cfscript> <cfquery name="q_three" dbtype="query"> select q_one.id, q_two.name from q_one, q_two where q_one.id = q_two.id </cfquery> </cffunction>

@zspitzer
Copy link

can you reopen this @ryaneberly ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants