Project

General

Profile

Bug #10479

Deleted record is added to session cache in ProgressiveResults.getResults

Added by Andrei Plugaru 11 months ago. Updated 11 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Andrei Plugaru 11 months ago

When a new bracket is processed in ProgressiveResults.getResults, this code is executed:

         Object[] lastRecord = null;
         if (delegate != null && delegate.last())
         {
            lastRecord = delegate.get();
         }

In the case when delegate is ScrollingResults, we will use an already existing result set to get the last record. However, if in the meantime that record was deleted we will still execute all the logic, which will also add in the session cache. This could be prone to errors, because we can afterward try to create another record which will get the same recid, and when it will be added to the cache, this error will be thrown: A different DMO instance of type is already bound to this session with the same recid.

In ProgressiveResults.getResults, we have logic for deleting the record from the cache, however, in this case it is not executed because the record has TRACKED state.
This a complete test case for the issue:

def temp-table table1 field id as int.

def temp-table table2 field id as int index pk as unique id.

def var i as int.
i = 0.
do while i < 11:
i = i + 1.
create table1.
table1.id = 1.
end.

create table2.
table2.id = 1.
release table1.
release table2.

procedure p1:
    def VAR hQuery as handle.

    CREATE QUERY hQuery.
    hQuery:SET-BUFFERS(BUFFER table1:HANDLE, BUFFER table2:HANDLE).
    hQuery:QUERY-PREPARE('FOR EACH table1, each table2 of table1').
    hQuery:QUERY-OPEN().
    hQuery:GET-FIRST ().
    i = 0.
    DO WHILE NOT hQuery:QUERY-OFF-END:
        message table1.id table2.id.
        if i >= 10 then   delete table1.
        i = i + 1.
        hQuery:GET-NEXT().
    end.
end.

do transaction:
    run p1.
end.

create table1.

Also available in: Atom PDF