background image
C H A P T E R 1 2
Special-Purpose Objects for Data Storage and Retrieval
Using Special-Purpose Data Storage Objects
12-13
Creating a Store Part
12
To create a store part, take the following steps using Newton Toolkit version 1.5
or greater:
Create a new project.
Select the Store Part radio button in the Output Settings dialog box. NTK disables
all other settings in this dialog box when the Store Part option is selected.
Configure the Package Settings dialog box as you normally would. The name
specified in this dialog box identifies the store part to the system in much the
same way that a package name identifies a package; thus, you need to ensure the
uniqueness of this identifier by basing it on your developer signature in some way.
Add a new text file to the project. You'll add to this document the NewtonScript
code that creates one or more soups to reside on the store part.
At compile time, NTK provides a global variable named
theStore
, which
represents the store part (package store) you are building. Any changes made to
this variable are reflected in the store part that is produced as the output of the build
cycle. Thus, to create your read-only soup, you can add to the text file some
NewtonScript code similar to the following example:
// some useful consts; note use of developer signature
constant kStoreName := "MyStore:MYSIG" ;
constant kSoupName := "MySoup:MYSIG" ;
constant kSoupIndices := '[] ;
// theStore is a global var provided by NTK
theStore:SetName(kStoreName) ;
// create the soup but don't xmit at build time
local soup:=theStore:CreateSoupXmit(kSoupName,
kSoupIndices, nil);
// add a couple entries
soup:Add({anInteger: 1}) ;
soup:Add({anInteger: 2}) ;
When the package is built, NTK incorporates the store part in it.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна