C H A P T E R 1 2
Special-Purpose Objects for Data Storage and Retrieval
Using Special-Purpose Data Storage Objects
12-7
Using Special-Purpose Data Storage Objects
12
This section describes how to use entry aliases, virtual binary objects (VBOs),
store parts, and mock entries. This section presumes understanding of the
conceptual material presented in preceding sections.
Using Entry Aliases
12
This section describes how to create entry aliases, how to save them, and how to
resolve them.
Aliases can be created for any entry that resides in a soup or union soup. Aliases
cannot be created for mock entry objects.
You must not assume that an entry alias is valid. When the entry to which it refers
is deleted or is moved to another store, an entry alias becomes invalid. Renaming a
store renders invalid all aliases to entries residing on that store.
The
MakeEntryAlias
function returns an alias to a soup entry, as shown in the
following code fragment:
// return entries that contain "bob" and "Apple"
local myCurs:= namesSoup:Query({ entireWords: true,
words:["Bob", "Apple"]});
// keep an alias to bob around
local bobAlias := MakeEntryAlias(myCurs:Entry());
// but get rid of the cursor
myCurs := nil;
To save an entry alias, simply save it in a soup entry.
You can use the
ResolveEntryAlias
function to obtain the entry to which the
alias refers, as shown in the following code fragment:
// continued from previous example
local bobEntry := ResolveEntryAlias(bobAlias);
Note that the
ResolveEntryAlias
function returns
nil
if the original store,
soup, or entry to which the alias refers is unavailable.