Title:
Bug 84209:(Watson Migration Closure)When a reteurn structure is created(we'll call it rtn) and then an update query is executed with a Name attribute of rtn (matching the name of the struct) it deletes the struct
| View in TrackerStatus/Resolution/Reason: Closed/Won't Fix/LowImpact
Reporter/Name(from Bugbase): Daniel Sellers / Daniel Sellers (designfrontier)
Created: 09/15/2010
Versions: 9.0.1
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Minor / Unknown
Locale/System: English / Platforms All
Vote Count: 0
Problem:
When a reteurn structure is created(we'll call it rtn) and then an update query is executed with a Name attribute of rtn (matching the name of the struct) it deletes the struct. Dumping it before the query gives you the struct appropriately. Dumping it after throws an error stating that the variable is not defined.If you change the name attribute to be rtn.query and then dump it after the UPDATE query there is a variable in the struct named rtn.query with a value of Undefined. Clearly you shouldn't assign a name attribbute to an update query but, if you do the behavior should not be deleting the struct completely.
Method:
Below is the Function that when called demonstrates the error.<cffunction name="setRace" access="public" returntype="struct" hint="Sets the users race"> <cfargument name="userid" type="numeric" required="true"> <cfargument name="raceid" type="numeric" required="true"> <cfscript> var rtn = {status=true};</cfscript> <cftry> <cfquery datasource="#getDSN()#" name="rtn.update"> SELECT userid FROM tas_race_lookup WHERE userid = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.userid#"> </cfquery> <cfif rtn.update.recordCount GT 0> <cfquery name="rtn" datasource="#getDSN()#"> UPDATE tas_race_lookup SET raceid = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.raceid#"> WHERE userid = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.userid#"> </cfquery> <cfelse> <cfquery datasource="#getDSN()#"> INSERT INTO tas_race_lookup(userid,raceid) VALUES( <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.userid#">, <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.raceid#"> ) </cfquery> </cfif> <cfcatch type="database"> <cfscript>rtn.status = false;rtn.error = cfcatch.Message;rtn.detail = cfcatch.Detail;</cfscript> </cfcatch> </cftry> <cfreturn rtn> </cffunction>
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3042184
External Customer Info:
External Company:
External Customer Name: Daniel Sellers
External Customer Email: 1E0E36B944201A20992015D5
External Test Config: 09/15/2010
Attachments:
Comments: