background image
C H A P T E R 1 1
Data Storage and Retrieval
Using Newton Data Storage Objects
11-53
mySoup
:MakeKey(["12345678901234567890", 3,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"],
['name.first, 'cardType, 'name.last] )
returns the key value
["12345678901234567890", 3, "ABCDEFGHIJKLMNO"]
The next example illustrates the truncation of subkeys when the total key size is
greater than 80 bytes. In this example, the first string in the string array is so long
that it uses up the entire 80 bytes allocated for the key, with the result that the first
string is truncated and the remaining key values are
nil
. Evaluating the following
code fragment in the Inspector
mySoup
:MakeKey(["12345678901234567890abcdefghijjlmnopqrstuvwxyz",
3, "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890"],
['name.first, 'cardType, 'name.last] )
returns the key value
["12345678901234567890abcdefghijjlmnopqr", NIL, NIL]
Missing elements in the string array are treated as
nil
values. For example, the
following code fragment is missing the second two elements of the string array:
mySoup
:MakeKey(["12345678901234567890],
['name.first, 'cardType, 'name.last] )
Evaluating this code fragment in the Inspector returns the key value
["12345678901234567890", NIL, NIL]
On the other hand, missing index paths cause this method to throw an exception. If
one of the index paths in a multiple-slot index is missing from the array passed as
the value of the indexPath parameter, the
MakeKey
method throws a "soup index
does not exist"
evt.ex.fr.store -48013
exception.
Using Cursors
11
This section discusses the functions and methods used to work with cursor objects
returned by the
Query
method of soups or union soups. Individual entries in soups
and union soups are manipulated by the entry functions described in the section
"Using Entries," later in this chapter. This section describes
getting the cursor
testing validity of the cursor
getting the currently referenced soup entry from the cursor
moving the cursor
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна