tracker issue : CF-4204873

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

current Row issue

| View in Tracker

Status/Resolution/Reason: To Fix//MustFix

Reporter/Name(from Bugbase): Ashwini A. / ()

Created: 07/18/2019

Components: Database, CFQuery

Versions: 2018,14.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: 5.1.4 (Build 0001) /

Priority/Frequency: Major / Some users will encounter

Locale/System: / Windows 8 64-bit

Vote Count: 0

Problem Description:
When we use the current row as an index and assign a value to it, while going through the loop. In the next iteration the current value resets to 1
Steps to Reproduce:
<cfset cacheTimespan = createTimeSpan(0, 0, 0, 1)>
<cfset test=1>
<cfquery datasource="testdsn" name="dept" cachedwithin="#cacheTimespan#">
	select id, name, 0 as tValue from scheduledepartment order by name 
</cfquery>

<cfoutput>

<cfloop query="dept">
	<cfif dept.id is test>
		Before: #dept.currentRow#<br>
		<cfset dept.name[dept.currentRow] = "test">
		After: #dept.currentRow#<br>
		<cfset dept.tValue[dept.currentRow] = 999>
	</cfif>

</cfloop>


</cfoutput>

Actual Result: 
Before 45
After 1

Expected Result:
Before 45
After 45

Any Workarounds:
1.If we remove the cachedWithin attribute, then it works fine. 
2. Keep the cachedWithin and remove the query scope, then also it works

FYI:
I did not use the queryNew, because it works. So, the mis behaviour is only happens when you pull the query from a database.

Attachments:

Comments: