Use the TABLE-HANDLE form
- Last Updated: September 22, 2023
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
The third parameter form is unique to temp-tables, and this is the
TABLE-HANDLE. You can use a TABLE-HANDLE to either
pass or receive a dynamic temp-table, just as you would use the TABLE
parameter form to pass a static temp-table.
|
|
The tt-handle handle itself is exactly the same value you would pass
as an ordinary HANDLE. However, the TABLE-HANDLE
keyword tells the AVM to pass not just the handle value but the entire definition and
contents of the table as well, in exactly the same form as the TABLE
parameter form uses.
You use the TABLE-HANDLE form to pass a dynamic temp-table and its
description to another routine, or to receive a temp-table as a dynamic parameter from
another routine, whether in the same session or on the other side of an application
server connection. The corresponding parameter in the other routine can be a static
TABLE or a dynamic TABLE-HANDLE.
The flexibility the TABLE-HANDLE form provides you is extremely
valuable. For example, you might have procedures running on the server that represent
business logic defined against static tables. On that side of the application, you can
build static temp-tables that include database fields, calculated fields, and other
elements. You can then pass the temp-table to the client using the
TABLE parameter form, since you have a static temp-table definition
locally.
On the client side of the application, you might have general purpose procedures to
retrieve temp-tables from the server, perhaps to display data, allow updates, and do
other client-side processing that might apply to many different tables received from the
server. A general-purpose procedure that has no specific single temp-table definition
can receive the table as a TABLE-HANDLE. It receives the entire table
definition and data from the caller and can access it through the handle.
All combinations of TABLE and TABLE-HANDLE are valid.
You can pass a static table using the TABLE form and receive it as a
dynamic TABLE-HANDLE. You can pass a TABLE and receive
it as a static TABLE of the same or compatible definition. You can pass
a dynamic TABLE-HANDLE and receive it as a static
TABLE, and you can pass a dynamic TABLE-HANDLE and
receive it as a dynamic TABLE-HANDLE on the other side.
Use the TABLE-HANDLE form when the temp-table is not defined locally and
you need to access it in a general way through its handle and buffer handle. Use the
TABLE form when the temp-table is defined locally with a static
DEFINE statement.