Buffer parameter definition in interface method - Forum - OpenEdge Development - Progress Community

Buffer parameter definition in interface method

 Forum

Buffer parameter definition in interface method

This question is answered

The following class compiles successfully:

CLASS Test:

DEFINE TEMP-TABLE ttTest
FIELD id AS INTEGER
FIELD NAME AS CHARACTER.

METHOD PUBLIC VOID TestMethod( BUFFER p-ttTest FOR ttTest ):

UNDO, THROW NEW Progress.Lang.AppError("METHOD NOT IMPLEMENTED").

END METHOD.

END CLASS.

If I try to define an interface for this class I get this error (on the METHOD line).

"Only datasets, temp-tables, and properties may be defined in an interface. (13149)"

INTERFACE SkuUnit.ITest:


DEFINE TEMP-TABLE ttTest
FIELD id AS INTEGER
FIELD NAME AS CHARACTER.

METHOD PUBLIC VOID TestMethod(BUFFER p-ttTest FOR ttTest).

END INTERFACE.

Removing the parameter allows it to compile successfully.

How can I define an interface method that matches this class?

Verified Answer
  • As Peter noted you can use a TABLE parameter (to pass the complete temp-table) or a HANDLE parameter for a buffer.  The challenge with using a TABLE parameter is that you will be passing more data than you may want to pass and the challenge with using a HANDLE for a buffer is that the method will need to use dynamic programming to access the information.

    The issue you have raised is a limitation with the implementation of interfaces.  I have added this issue to the Language team’s backlog.

    Please note, that if you did not want to enforce the method signature via an Interface, the existing method syntax does support passing a buffer. This limitation exists with the ABL’s ability to enforce the method signature via interfaces.

    Evan Bleicher

    Sr. Development Manager

    Progress Software

All Replies
  • You may have to use either a TABLE parameter or a HANDLE for a buffer.
     
  • As Peter noted you can use a TABLE parameter (to pass the complete temp-table) or a HANDLE parameter for a buffer.  The challenge with using a TABLE parameter is that you will be passing more data than you may want to pass and the challenge with using a HANDLE for a buffer is that the method will need to use dynamic programming to access the information.

    The issue you have raised is a limitation with the implementation of interfaces.  I have added this issue to the Language team’s backlog.

    Please note, that if you did not want to enforce the method signature via an Interface, the existing method syntax does support passing a buffer. This limitation exists with the ABL’s ability to enforce the method signature via interfaces.

    Evan Bleicher

    Sr. Development Manager

    Progress Software