Project

General

Profile

Bug #6941

conversion issue when using undo in do transaction

Added by Radu Apetrii over 1 year ago. Updated 9 months ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#1 Updated by Radu Apetrii over 1 year ago

There is a problem when converting examples that contain an undo statement inside a do transaction.
For example, this is the 4GL code:

define temp-table test field f1 as integer field f3 as integer.

create test.
for each test:
    test.f1 = 995.
    test.f3 = 13.
    undo.
end.

find first test.
message test.f1 test.f3.
When I convert this code, everything that happens after the undo statement does not convert (it does not matter if the code is inside the do transaction or not).
This is the converted code:
package com.goldencode.dataset;

import com.goldencode.p2j.util.*;
import com.goldencode.p2j.persist.*;
import com.goldencode.dataset.dmo._temp.*;
import com.goldencode.p2j.persist.lock.*;

import static com.goldencode.p2j.util.BlockManager.*;
import static com.goldencode.p2j.util.InternalEntry.Type;

/**
 * Business logic (converted to Java from the 4GL source code
 * in start.p).
 */
public class Start
{
   Test_1_1.Buf test = TemporaryBuffer.define(Test_1_1.Buf.class, "test", "test", false);

   /**
    * External procedure (converted to Java from the 4GL source code
    * in start.p).
    */
   @LegacySignature(type = Type.MAIN, name = "start.p")
   public void execute()
   {
      externalProcedure(Start.this, new Block((Body) () -> 
      {
         RecordBuffer.openScope(test);
         test.create();

         doBlock(TransactionType.FULL, "blockLabel0", new Block((Body) () -> 
         {
            test.setF1(new integer(995));
            test.setF3(new integer(13));
            undoLeave("blockLabel0");
         }));
      }));
   }
}
As a note, if the statement is undo, leave instead of just undo, the code converts fine. I tested this with 3821c, rev. 14361.

#3 Updated by Radu Apetrii 9 months ago

It seems that this has been solved in the meantime. I tested with trunk, rev. 14709 and everything worked fine. No issues found in both conversion and runtime.

#4 Updated by Alexandru Lungu 9 months ago

  • Status changed from New to WIP
  • % Done changed from 0 to 100
  • Start date deleted (11/17/2022)

This can be closed / rejected.

#5 Updated by Greg Shah 9 months ago

  • Status changed from WIP to Rejected

Also available in: Atom PDF