18 Replies Latest reply on Jul 20, 2016 9:58 AM by Carl Von Stetten

    Query scope descrepancy between tag and script

    Steve Sommers Level 4

      I'm fairly certain I found a scope bug. I'm using CF11 and FW/1 and I have the following query -- the tag works, the cfscript equivilent triggers a "Table named rc.qSignerLinks was not found in memory" exception:

       

      /* works*/

      <cfquery name="local.qResultSet" result="local.qResult" dbtype="query">

          SELECT

              *

          FROM

              rc.qRSRecipient

          where

              [email] = <cfqueryparam value="#session.user.getEmail()#" cfsqltype="CF_SQL_VARCHAR" maxlength="50" />

      </cfquery>

       

      /* exception */

      <cfscript>

          local.qObj = new query();

          local.qObj.setDBType("query");

          local.qObj.setSQL("

              SELECT

                  *

              FROM

                  rc.qRSRecipient

              where

                  [email] = :email

          ");

          local.qObj.addParam( name="email",value="#session.user.getEmail()#",cfsqltype="CF_SQL_VARCHAR",maxlength="50" );

          local.qObjResult = local.qObj.execute();

          local.qResultSet= local.qObjResult.getResult().recordCount NEQ 0;

      </cfscript>