background image
C H A P T E R 1 1
Data Storage and Retrieval
Using Newton Data Storage Objects
11-31
for such stores. Do not use the global function
IsReadOnly
to test store objects;
use only the
IsReadOnly
store method for this purpose.
Getting or Setting the Default Store
11
The default store is that store designated by the user as the one on which new data
items are created. Normally, applications using union soups do not need to get or
set the default store. The system-supplied functions that accept union-soup
arguments handle the details of saving and retrieving soup data according to
preferences specified by the user.
If for some reason you need to get or set the default store yourself, you can utilize
the
GetDefaultStore
and
SetDefaultStore
global functions.
Note
Do not change the default store without
first notifying the user.
Getting and Setting the Store Name
11
Normal NewtonScript applications rarely need to get or set store names. A store's
name is the string that identifies the store in slips displayed to the user. The default
name for the internal store is "Internal" and a PCMCIA store is named "Card" by
default. The store methods
GetName
and
SetName
are used to get and set the
names of stores.
The following example uses the
GetName
method to obtain a string that is the
name of the internal store:
//returns the string "Internal"
GetStores()[0]:GetName();
Before attempting to set the store's name or write any other data to it, you can use
the store methods
IsReadOnly
or
CheckWriteProtect
to determine whether
the store can be written.
W A R N I N G
Renaming a store renders invalid all aliases to entries residing on
that store. See "Using Entry Aliases" on page 12-7.
Accessing the Store Information Frame
11
Each store may hold an optional information frame that applications can use to
save information associated with the store itself. Note that unless an application
stores data in this frame, it may not exist on every store.
The
GetInfo
and
SetInfo
store methods are intended for use by backup/restore
applications only; most applications need not use them at all. The
GetInfo
store
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна