C H A P T E R 1 1
Data Storage and Retrieval
11-36
Using Newton Data Storage Objects
After creating the new soup entry, these methods transmit a soup change
notification message. To suppress the soup change notification message that -
Xmit
functions and methods transmit, pass
nil
as the value of their changeSym
argument. For more information, see "Using Soup Change Notification" beginning
on page 11-63; also see the descriptions of the
AddToDefaultStoreXmit
and
AddToStoreXmit
methods in "Soup Functions and Methods" (page 9-35) in
Newton Programmer's Reference.
Normally the member soups in a union are created automatically by the system as
needed to save frames as soup entries. If you need to force the creation of a union
soup member on a specified store without adding an entry to the new member soup,
use the
GetMember
union soup method to do so. For more information, see the
description of this method in "Soup Functions and Methods" (page 9-35) in
Newton Programmer's Reference.
Adding an Index to an Existing Soup
11
Normally, applications create an index for each slot or set of slots on which a soup
may be searched frequently. Although the soup's indexes are usually created along
with the soup itself, you may occasionally need to use the
AddIndexXmit
method
to add an index to an already existing soup and transmit a soup change notification
message. Indexes must be added individually--you can't pass arrays of index specs
to the
AddIndexXmit
method.
W A R N I N G
You cannot query a union soup on an index that is not present in
all its member soups. Sending the
AddIndexXmit
message to a
union soup adds the specified index to all soups currently
available to the union; however, any soup introduced to the union
subsequently has only its original complement of indexes, which
may not include the index this method added. Similarly, any
member soup created by the system has only the indexes specified
by its soup definition, which may not include the index this
method added.
The following code fragment adds an index to the
"mySoup:myApp"
union soup,
enabling queries to search for integer data in that soup's
mySlot
slot:
// get my union soup
local myUSoup := GetUnionSoupAlways("mySoup:mySig");
// add a new single-slot index on the'mySlot slot
local myISpec := {structure:'slot, path:'mySlot, type:'int};
local myUSoup:AddIndexXmit(myISpec,'|myApp:mySig|);