tracker issue : CF-3041431

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

Bug 82841:When using the new CFSCRIPT implementation cfquery (the query() object), named parameters fail when used in a sub-select statement

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Ryan McIlmoyl / Ryan McIlmoyl (Ryan McIlmoyl)

Created: 05/11/2010

Components: Database, CFQuery

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 9,0,0,251028 /

Priority/Frequency: Minor / Unknown

Locale/System: English / Win All

Vote Count: 0

Problem:

When using the new CFSCRIPT implementation cfquery (the query() object), named parameters fail when used in a sub-select statement.  Unnamed paramaters work fine.
Method:

1) Create a query object.
2) Add a named parameter.
3) Create a SQL statement with a sub-select.
4) Use the named parameter in the sub-select.ie.  
local.myQuery = new query(datasource = variables.dsn);
local.myQuery.addParam(name="courseid", value = variables.courseid, cfsqltype="INTEGER");
local.students = local.myQuery.execute(sql = "SELECT * FROM studentsWHERE studentid IN (   SELECT studentid    FROM enrollments   WHERE courseid = :courseid)
Removing the name from the parameter and using :? will work, while the above will fail.



ksaini: Below is working fine on CF901 beta:

<cfscript>
local.myQuery = new query(datasource = "cfartgallery");
local.myQuery.addParam(name="artid", value = 2, cfsqltype="INTEGER");
local.students = local.myQuery.execute(sql = "SELECT * FROM artists WHERE artistid 

IN (   SELECT artistid    FROM art   WHERE artid = :artid)");

writedump(local.students);
</cfscript>

Result:

variable SQL is undefined

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

Watson Bug ID:	3041431

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: R M
External Customer Email: 32730B03447DCC86992016B7
External Test Config: 05/11/2010

Attachments:

Comments: