background image
C H A P T E R 1 2
Special-Purpose Objects for Data Storage and Retrieval
12-12
Using Special-Purpose Data Storage Objects
// decide to go back to the original
EntryUndoChanges(anEntry);
PlaySound(anEntry);
// clean up
foreach store in GetStores() do
begin
mySoup := store:GetSoup("foo:myApp:mySig") ;
if mySoup then
mySoup:RemoveFromStoreXmit(nil);
end ;
UnregUnionSoup("foo:myApp:mySig", '|foo:myApp:mySig|);
VBOs and String Data
12
In most cases, you should avoid using the
&
and
&&
string-concatenation operators
with VBO-based strings. These operators work by allocating a new string in the
NewtonScript heap and copying data from its arguments into the new object. You
can run out of heap space easily when attempting this operation with large strings.
Instead, use the
StrMunger
global function to concatenate two strings. The
following code fragment appends the
str2
string to the
str1
string, increasing
the size of
str1
as necessary, regardless of whether
str1
is VBO data or resident
in the NewtonScript heap.
StrMunger(str1, MAXINT, nil, str2, 0, nil);
The value of
MAXINT
is
1<<29-1
or
536870911
; however, any number larger
than
StrLen(str1)
works adequately.
Using Store Parts
12
This section describes how to create a store part and add soup data to it. This
discussion is followed by a description of how to access the store part's soups
from your application.
Note that other representations may provide better space efficiency or faster access
to data. Store parts are useful when you wish to avoid recoding soup data in a more
efficient representation, or when you need multiple indexes or some other
convenience that soup-based queries provide.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна