Re: Multiple Initializations of a Package

From: QuadTwin <quadtwin_at_aol.com>
Date: 1997/09/11
Message-ID: <19970911034201.XAA11471_at_ladder02.news.aol.com>#1/1


jstarkey_at_exeter.com wrote:

> I have a package in a library containing procedures invoked from both
> menu startup code and a WHEN-NEW-FORM-INSTANCE trigger that is
> suffering from both multiple initializations and multiple invocations
> of the package start up code. When I bring up a second form, also
> referencing the pack on a WHEN-NEW-FORM-INSTANCE trigger, the package
> is initialized a third time.
>
> The Developer/2000 documentation is quite clear that package
> variables are initialized once per session, and persist for the
> duration of the session. I am rather depending on this to implement a
> large, many formed application.
>
> I'm running on NT 4.0 Workstation w/ 96 MB with adequate disk space.
>
> A possibly related problem is the inability of a menu to find a
> RecordGroup successfully created in another instance of the same
> menu.
>
> The problem suggests either a configuration problem or a profound
> misunderstanding of package semantics and/or implementation.
>
> Any ideas would be greatly appreciated.

I hate to get on a rant here but I think you're out of luck. Packages in a PLL (Dev2k program library) operate somewhat differently than packages stored in the Oracle Server (which is what I think the doco you are reading refers to).

The initial invocation of your package specification and body cause a copy of the package to be loaded into each Form or Menu module. Variables defined in the package are initialized uniquely for each module. On the Server, the same package could share a single copy of these variables as long as your multi-form application does not use OPEN_FORM with the SESSION option. If you specify SESSION, then each Form is a separate Server session and gets its own private copy of Server package variables.

Sharing data among Forms in a multi-form application (or between a menu module and a single form) is only possible via global variables. Oracle doesn't
quite get the importance of making sharing simple and intuitive. The drag-n-drop partitioning of packages between client and server is not as transparent as their simple-minded demos would have you believe. (I am intentially avoiding the use of a temporary table due to performance considerations, but it is possible).

I hope someone can contradict this advice but it has been acquired after a lot of trial and error. I would like to know of any tricks if they exist.

Hope this helps,

Al

Al Lawson
Interactive Group, Inc.
www.interactive-group.com
lawsona_at_interactive-group.com Received on Thu Sep 11 1997 - 00:00:00 CEST

Original text of this message