Kbase P118818: Passing ProDataSet by reference fails if receiving procedure defines ProDataSet as SHARED
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/09/2006 |
|
Status: Unverified
FACT(s) (Environment):
OpenEdge 10.x
SYMPTOM(s):
Passing ProDataSet BY-REFERENCE
Called procedure defines ProDataSet as SHARED
Code in called procedure does not find expected records
ProDataSet handles in calling and called procedure are identical
Temp-table handles in calling and called procedure are different
CAUSE:
This is expected behavior.
The scoping models for SHARED definitions and for passing BY-REFERENCE are not fully compatible.
If a procedure defines the ProDataSet as SHARED it can pass this into another procedure BY-REFERENCE.
But if the procedure receiving a ProDataSet BY-REFERENCE defines the ProDataSet as SHARED or NEW SHARED, this can violate the scoping rules for the shared ProDataSet.
FIX:
Possible solutions:
1. In the called procedure, force passing of the ProDataSet by specifying the BY-VALUE option on the DEFINE PARAMETER statement.
Note that doing this means giving up the improved performance and lower resource usage provided by passing BY-REFERENCE, so this is not advisable in the long term.
2. Rewrite the code so it no longer relies on the SHARED objects. This can be done by ensuring the ProDataSets are always passed up the procedure chain BY-REFERENCE, or (starting with OpenEdge 10.1A) by relying on the REFERENCE-ONLY and BIND options.