If it were CFQuery, you would have one cfqueryparam for each value:
where myTable.id = <cfqueryparam... value="#arguments.id#" /> or myTable.parentid = <cfqueryparam ... value="#arguments.id#" />
so I assume that you need to do the same in the script:
local.query.setSql(" SELECT id FROM myTable WHERE myTable.id = :id OR myTable.parentId = :pid "); local.query.addParam(name="id", cfsqltype="CF_SQL_INTEGER",value=arguments.id,maxlength=10); local.query.addParam(name="pid",cfsqltype="CF_SQL_INTEGER",value=arguments.id,maxlength=10);
Regarding the question “why cannot one placeholder address both AddParam addresses”, I assume that it comes down to how the request is parsed by ColdFusion, because you specify two placeholders for the parameters, which, apparently, the parser expects to find two parameters defined ,
source share