Consultor Eletrônico



Kbase 16138: Guidelines for shared temporary tables in ADM - smartobjects
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Guidelines for shared temporary tables in ADM - smartobjects

USING SHARED TABLES with SMARTOBJECTS
-------------------------------------

SmartObjects are each meant to be fully encapsulated
which means that one object does not 'know' about the
workings of another object. They are completely
separate and independent objects that communicate by
messaging over established links.

Sharing tables is generally not recommended in the
SmartObject environment;however, this knowledgebase entry
will offer some guidelines when using them.

The first problem that may occur when attempting to access
a shared table is in design mode. When you open up a smartWindow
in the UIB, an attempt to run each smartObject contained in the
window is made. If the smartObject is based on a SHARED TEMPORARY
TABLE, the object will not be runnable UNLESS the NEW SHARED
definition has already been encountered. You may receive
error 1429 'Unable to locate shared temp-table or work-table
definition for table <table-name>.'. Note: this is also true
for smartObjects based on shared variables, shared buffer or
shared queries.

You may think that putting the NEW SHARED table definition in the
smartWindow is sufficient but the SmartWindow will not be run as
soon as it is brought into the UIB so that definition will not
be encountered BEFORE the smartObject is run. The recommended
place to define the NEW SHARED temp-table is in a 'wrapper'
procedure that can be run BEFORE the UIB from your Progress icon.
For example,

1. create a .p that defines your new shared temp-tables
2. have that same .p then run the Progress desktop

/*mywrap.p */
{temp.i NEW} /* temp.i contains the definition of shared temp table*/
run _desk.p /* runs the progress desktop */

Your progress desktop icon should have the command line:
_prowin.exe -p mywrap.p

This will ensure that when the UIB is run, the NEW SHARED temp
tables will all be defined and 'known' at the time a SmartWindow is
opened and its smartObjects are run. You will no longer get the
1429 error at design time and you will be able to run your smartWindow
successfully.

Note: The copy of the temp-table used at design time will be separate
from the run-time copy.

When you are ready to run this Window in a production environment,
you will still need the NEW SHARED temp table definition in the
main .w or .p of your application. In this case, you will be running an
icon with command similar to this:

_prowin.exe -p mymain.p

where mymain.p defines all of your temp tables before running the rest
of your application. You can also substitute mymain.p with the main
SmartWindow if the NEW Shared table is defined there.

Note: In 8.1A, Progress will introduce the concept of GLOBAL shared
temporary tables which helps to solve
the problem of not being able to find the new shared table.

Progress Software Technical Support Note # 16138