%Library.Storageabstract class %Library.Storage
Physical Storage Base Class
STORAGEINTERFACE defines the type of serialization implemented by this class. The value has to match the classtype of the class that is inheriting the serialization interface.
Builds entries for each index specified in the idxlist argument. If pIndexList is empty then all indices that originate in the class are rebuilt. If no indexes are specified in pIndexList or there are other bitmap indexes specified in pIndexList and there is a bitmap extent index defined for the class and there are currently no entries in the bitmap extent index then it will be implicitly included in pIndexList. If there is an ID range specified in pStartID-pEndID and there are either no indexes specified in pIndexList or if indexes are specified then at least one of them is a bitmap index then the bitmap extent index will be implicitly included in pIndexList. If the bitmap extent index is included then the bitmap extent index for each subextent is also built.
If pAutoPurge is true then the indices contained in pIndexList will be purged before they are built as long as no range is specified, if a range is specified we will skip any purge. The default is TRUE (1).
If pLockFlag is one (1) then an extent lock will be acquired before the indices are built. If the lock cannot be acquired then an error is returned. The lock is released after the index build is completed. If it is two (2) then a lock is acquired prior to filing indexes for that instance and it is released as soon the indexes for that instance are filed. If it is zero (0) then no locks are used while filing the indexes. If it is three (3) then it an shared extent lock will be acquired before the indices are build.
If pJournalFlag is false then journaling is disabled for the processes used to build the indexes. If this flag is true then the journal status is not altered during BuildIndices(). The default value of this argument is 1 (TRUE).
pStartID and pEndID define a range of IDs for which indexes will be built. The range is inclusive. If the starting ID is not passed a non-null value then the range begins at the first ID defined in the extent. If the ending ID is not passed a non-null value then the range ends at the last ID defined in the extent.
If pIgnoreIndexList is defined, it should be a $listbuild of index names that should not be built. This argument allows you to build all indices except those defined in pIgnoreIndexList. The default value of this argument is "", which means all indices, or all indices specified in pIndexList, will be built.
If your index is corrupt running this function will not fix the corruption unless you rebuild the entire index and purge the existing indexes. If you have inserted some new items but have deferred building the index for these new items then you can run %BuildIndices on this range oif IDs to add the index entries for these new items.
This method is normally generated by the storage class for persistent classes using
%Storage.Persistentor %Storage.SQL. Persistent classes using some other storage class, such as %Library.CustomStoragemust override this method.
%KillExtentData() - kills extent data in storage. This method is implemented by the storage class. If killstreams is true (default is false) it will also kill the default stream storage global.
%LoadData() - loads an object from storage. This method is implemented by the storage class.
Deletes all entries from each index specified in the idxlist argument. If idxlist is empty then all indices that originate in the class are purged. The index definition remains intact.
If pIgnoreIndexList is defined, it should be a $listbuild of index names that should not be purged. This argument allows you to purge all indices except those defined in pIgnoreIndexList. The default value of this argument is "", which means all indices, or all indices specified in pIndexList, will be purged.
%Statusvalue indicating success or failure. This method is normally generated by the storage class for persistent classes using %Storage.Persistentor %Storage.SQL. Persistent classes using some other storage class, such as %Library.CustomStoragemust override this method.
%SQLBuildPurgeIndexForRow - given a list of indices (or all by default), an ID, and new and old values, purge and build the index entries for the row pIndices - $listbuild of index map names to purge/build. Default is "" and means purge/build all indices pActions - A string of action characters to perform. If pActions["P", the old index entries will be Purged/Deleted. If pActions["B", the new index entries will be Built/Defined. The default is pActions="BP". This can be overridden to provide a way to just Purge a row's index entries (delete) or to define a row's index entries (Insert). Any other characters in pActions besides "B" or "P" are ignored. pLockRow - 1/0 flag, default=1, 1 means acquire an exclusive, long-term lock on the row. 0 means no lock is acquired. %d() - Array subscripted by SqlColumnNumber which holds new values for indexed entries to be built %e() - Array subscripted by SqlColumnNumber which holds old values for indexed entries to be purged pIgnoreIndexList - $listbuild of index map names to not purge/build. Can be used in conjuction with pIndices to purge/build all indices except thise list. Default is "".
This class just holds stub methods that will be injected into the class definition by the table compiler. No implementation details here.
%SaveData() - saves an object to disk, checks uniqueness and referential integrity constraints, and maintains index structures. This method is implemented by the storage class.
%ValidateIndices() - Validates indices for a class
- Optional. "" to check all indices, or specify a $list of index names to check. Default=""
- Optional. If true, correct any errors found. Default=0
- Optional. Default = 1 0 - No locking is performed at all 1 - Shared locking as each row is checked 2 - exclusive lock on entire table for duration of the run
- Optional. If true, parts of %ValidateIndices will use parallel processing when possible. Default=1
- Optional. If true, display output to the current device. Default=1
- Optional. Passed by reference. Returns an array of errors found in the index(es) validated. If autoCorrect=1, this is an array of issues corrected.
Do $SYSTEM.OBJ.ValidateIndices("Sample.Person","",1,2) Do $SYSTEM.OBJ.ValidateIndices("Sample.Company",$lb("NameIdx"),1,1)
Indices may also be validated by calling the class method $SYSTEM.OBJ.ValidateIndices(classname,idxList,autoCorrect,lockOption).
There is one main difference between validating indices through $SYSTEM.OBJ.ValidateIndices() and ##class(classname).%ValidateIndices().
$SYSTEM.OBJ.ValidateIndices() will validate the indices for a table, and it will also validate any indices in collection child tables for that table.
When using ##class(classname).%ValidateIndices(), collection child table indices must be checked with separate calls.
Also, when calling $SYSTEM.OBJ.ValidateIndices(), multiProcess default is 0. When calling ##class(classname).%ValidateIndices(), multiProcess default is 1.