Consultor Eletrônico



Kbase P44076: How to pass a ProDataSet BY-VALUE locally
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

GOAL:

How to pass a ProDataSet BY-VALUE locally

FACT(s) (Environment):

OpenEdge 10.0x

FIX:

When passing a ProDataSet in a local session the default behavior is that the ProDataSet is passed BY-REFERENCE (so rather than making a copy of the object we just use a pointer to the same object for performance). This may cause problems if, for example, procedure1 calls procedure2 which creates the ProDataSet and passes it back as an output parameter. If procedure2 is then deleted then the ProDataSet is also deleted and procedure1 cannot reference the object.
To resolve this, pass the ProDataSet BY-VALUE. This means that a copy of the object is made so if procedure2 is deleted, the copy remains in procedure1.

To do this add the BY-VALUE keyword to the DEFINE PARAMETER, eg.
DEFINE OUTPUT PARAMETER DATASET FOR myDS BY-VALUE.