[Stackoverflow] [Progress OpenEdge ABL] UNDO statement releases available buffer within class instance

Status
Not open for further replies.
W

W0lfw00ds

Guest
I've added the test codes down below.

TestClass has BUFFER variable inside itself which is available after the execution of it's CONSTRUCTOR. Everything works fine until the code executes any UNDO or (UNDO, THROW...). After this the class instance is otherwise intact, except that the BUFFER variable is now NOT AVAILABLE.

Is there any way to prevent Progress from doing this RELEASE?

In the below test codes, the second iValue = oTestClass:Value. will throw error because the BUFFER is UNAVAILABLE.

I'm using Progress 11.7.5.

test.p:

Code:
DEF VAR oTestClass AS CLASS TestClass NO-UNDO.
DEF VAR iValue     AS INT NO-UNDO.

DO TRANSACTION:
    oTestClass = TestService:Singleton:Find().
    iValue= oTestClass:Value.
    UNDO.
END.

DO TRANSACTION:
    oTestClass = TestService:Singleton:Find().
    iValue = oTestClass:Value.
    UNDO.
END.

TestClassService.cls:

Code:
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS TestService:
    
    DEF PUBLIC STATIC PROPERTY Singleton AS CLASS TestService NO-UNDO
        GET:
            IF TestService:Singleton = ? THEN TestService:Singleton = NEW TestService().
            RETURN TestService:Singleton.
        END.
        PROTECTED SET.
    
    DEF PRIVATE VAR oTestClass AS CLASS TestClass NO-UNDO.
    
    CONSTRUCTOR PROTECTED TestService(): END.
    
    METHOD PUBLIC CLASS TestClass Find():
        IF oTestClass = ? THEN DO:
            oTestClass = NEW TestClass(TO-ROWID("0x000000000017c201")).
        END.
        RETURN oTestClass.
    END.
END.

TestClass.cls:

Code:
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS TestClass:
    DEF PRIVATE BUFFER MyTable_This FOR MyTable.
    DEF PUBLIC PROPERTY Value AS INT NO-UNDO
        GET:
            RETURN MyTable_This.Value.
        END.
    
    CONSTRUCTOR PUBLIC TestClass(i_rROWID AS ROWID):
        FIND FIRST MyTable_This WHERE ROWID(MyTable_This) = i_rROWID NO-LOCK.
    END.
END.

Continue reading...
 
Status
Not open for further replies.
Top