Project

General

Profile

Bug #7776

Previous regression on FWD-H2 lazy mode

Added by Alexandru Lungu 8 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Low
Assignee:
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#1 Updated by Alexandru Lungu 8 months ago

  • Priority changed from Normal to Low
def temp-table tt field f1 as integer field f11 as char index idx1 f1.
define query q for tt.

def var i as int no-undo.

do transaction:
    create tt. tt.f1 = 1. tt.f11 = "a".
    create tt. tt.f1 = 2. tt.f11 = "b".
    create tt. tt.f1 = 3. tt.f11 = "c".
end.

open query q for each tt.
do i = 1 to 2 on stop undo, leave:
    message "Try" i.
    get last q.
    message tt.f1 query-off-end("q"). // 3
    get prev q.
    message tt.f1 query-off-end("q"). // 2
    get prev q.
    message tt.f1 query-off-end("q"). // 1
    get prev q.
    if avail(tt) then message tt.f1 query-off-end("q"). else message "??" query-off-end("q"). // ?? yes
    get prev q.
    if avail(tt) then message tt.f1 query-off-end("q"). else message "??" query-off-end("q"). // ?? yes
    get next q.
    message tt.f1 query-off-end("q"). // 1 no
end.
message available(tt).
message query-off-end("q").

The output in 4GL:

Try 1
3 no
2 no
1 no
?? yes
?? yes
1 no
Try 2
3 no
2 no
1 no
?? yes
?? yes
1 no

The output in FWD:

Try 1
3 no
2 no
1 no
?? yes
?? yes
1 no
Try 2
3 no
** No tt record is available. (91)
? yes
** No tt record is available. (91)
? yes
?? yes
?? yes
** No tt record is available. (91)
? yes
no

TL;DR: I do the same scenario two times. The second time, when doing get prev q, the record is not found. In FWD-H2, I reached LazyResult.hasPrevious, where beforeLast is true. Radu, I don't quite get beforeLast; should it have been beforeFirst? If that is the case, note that beforeLast can be reset back to false if we ever do next. This is my example, going before the first record, going to the last record and doing a prev.

#2 Updated by Radu Apetrii 8 months ago

Alexandru Lungu wrote:

If that is the case, note that beforeLast can be reset back to false if we ever do next.

That was exactly the missing piece. I added this logic for both beforeFirst and afterLast. I also changed the name from beforeLast to beforeFirst, thanks for pointing out.

The changes can be found on 7066b_h2, rev. 28. Also, there are two tests added to TestLazy that simulate the behavior of the test from #7776-1.

#3 Updated by Alexandru Lungu 7 months ago

  • Status changed from WIP to Review

This was merged to FWD-H2 trunk as rev. 28 and reached trunk as fwd-h2-1.31-trunk.

#4 Updated by Alexandru Lungu 4 months ago

  • Status changed from Review to Test

This can be closed.

#5 Updated by Greg Shah 4 months ago

  • % Done changed from 0 to 100
  • Status changed from Test to Closed

Also available in: Atom PDF