Consultor Eletrônico



Kbase P69235: How to share a temp-table between two procedures & INPUT-OUTPUT PARAM TABLE/TABLE-HANDLE
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/3/2005
Status: Unverified

GOAL:

How to share a temp-table between two procedures?

GOAL:

Does DEFINE INPUT-OUTPUT PARAM TABLE FOR myTempTable share a temp-table between two procedures?

GOAL:

Does DEFINE INPUT-OUTPUT PARAM TABLE-HANDLE FOR myTempTable share a temp-table between two procedures?

FACT(s) (Environment):

Progress 9.1X

FIX:

The INPUT-OUTPUT PARAM TABLE and INPUT-OUTPUT PARAM TABLE-HANDLE syntax results in sharing the temp-table only if the RUN is calling an internal procedure located in the same external procedure (same .p or .w file). Otherwise a copy of the temp-table is done in the called procedure, even if everything is taking place within one single 4GL session (i.e. without involving an AppServer).
Note that the TABLE-HANDLE parameter type was invented for passing a temp-table to a remote AppServer 4GL session. Indeed, passing a simple HANDLE variable would not work because the scope of a handle is limited to one single 4GL session.

There are only two ways to really share a temp-table between two external procedures (i.e. not making a copy of the temp-table in the other procedure):
1) Use the [NEW [GLOBAL]] SHARED options when defining the temp-table. This is the only way to enable static programming in the called procedure.
or
2) Pass the handle of the temp-table or the handle of one of its buffer as a HANDLE parameter (not TABLE-HANDLE) to the called procedure. This solution requires dynamic programming in the called procedure.

There is a known little confusion in the documentation that says for the DEFINE PARAMETER Statement: "If the parameter is INPUT-OUTPUT TABLE-HANDLE, a combination of the above will occur. If the temp-table is ##local##, its handle will be used to identify it for both the caller and called routines so that it need not be copied."

Here, "##Local##" stands for 'Within the same external procedure' and not 'within the same 4GL client session'