The component must create the collection before it can create shared variables.
Create a collection and return a reference to the collection using the JagNewCollection routine. The component object must have a reference to a collection before calling any other routines on the collection.
Create a shared variable in a collection and return a reference to the shared variable using the JagNewSharedData or JagNewSharedDataByIndex routine. The component instance must have a reference to a shared variable to access the contents of that shared variable.
To create a new collection, call the JagNewCollection routine. This routine:
Creates a new collection with the specified lock level, returns a reference to that collection, and sets *pExists to JAG_FALSE, or
Returns a reference to the existing collection with the specified name and sets *pExists to JAG_TRUE. The input lock level is ignored, and the collection’s current lock level is returned in *pLockLevel.
Lock level must be set to one of the following:
JAG_LOCKCOLLECTION – allows locks to be set on collections
JAG_LOCKDATA – does not allow locks to be set on collections
To create a new shared variable, call the JagNewSharedData or JagNewSharedDataByIndex routine. These routines create a shared variable value initialized to NULL. JagNewSharedData creates a new shared variable or returns a reference to an existing shared variable by name. JagNewSharedDataByIndex creates a new shared variable or returns a reference to an existing shared variable by index number. A shared variable created by index can only be retrieved or updated by index. Similarly, a shared variable created by name can only be retrieved or updated by name. Since a reference is returned, you do not need to follow these routines with the JagGetSharedData or JagGetSharedDataByIndex routine.
For both routines, *pExists is set to:
JAG_TRUE if the shared variable does not exist
JAG_FALSE if the shared variable exists
Copyright © 2005. Sybase Inc. All rights reserved. |