background image
C H A P T E R 1 1
Data Storage and Retrieval
Using Newton Data Storage Objects
This approach provides the following benefits:
It prevents your application from inadvertently damaging another
application's data.
It helps your application avoid name conflicts with other applications' slots.
It prevents soups from becoming cluttered with excessive numbers of entries.
It facilitates removal of your application's data.
Note that when you makes changes to other applications' soups you should
transmit notification of the changes by means of the mechanism described in
"Using Soup Change Notification" beginning on page 11-63.
Adding Tags to an Existing Soup
You can add tags only to a soup that has a tags index. To add new tags to a soup
that already has a tags index, simply add to the soup an entry that uses the new
tags--the tags index is updated automatically to include the new tags.
Adding a tags index to an existing soup is like adding any other kind of index:
simply pass the appropriate index spec to the soup's
Remember, however, that the system allows only one tags index per soup. If you try
to add another tags index to that soup, you'll replace the original tags index. It's
quite easy to add new tags to a soup that already has a tags index, so you'll rarely
need to replace a soup's tags index.
Using Queries
To retrieve soup entries, you need to query a soup or union soup object by sending
message to it. The
method accepts a query specification frame,
or query spec, as its argument. The query spec specifies the characteristics that
soup entries must have in order to be included in the query result.
For instructional purposes, this section describes each item that
may appear in a query specification separately. Normally, a single
query spec defines multiple criteria that soup entries must meet to
be included in the results of the query; for example, you can
create a single query spec that specifies tests of index key values,
string values, and tags.
This section describes how to perform various queries to retrieve soup data. It
includes examples of
simple queries on index values, tags, or text
the use of ascending and descending indexes
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна