-- File: DBModelPrivate.mesa -- Contents: Internal data structures and types for Model Level modules of Cedar DB. -- File created by Rick Cattell, September 1980 -- Last edited by: -- Cattell on: November 8, 1983 11:10 am -- Willie-Sue on January 27, 1983 2:04 pm DIRECTORY DB, DBStorage, DBModel, DBTuplesConcrete, DBEnvironment, Rope; DBModelPrivate: DEFINITIONS IMPORTS DB, DBStorage, Rope SHARES DBModel = BEGIN OPEN DB, DBTuplesConcrete; -- Types ROPE: TYPE = Rope.ROPE; TupleHandle: TYPE = REF TupleObject; TupleObject: TYPE = DBTuplesConcrete.TupleObject; TupleSet, Attribute, Index, IndexFactor: TYPE = TupleHandle; Value: TYPE = REF ANY; AttributeValueList: TYPE = LIST OF AttributeValue; AttributeValue: TYPE = DB.AttributeValue; AttributeList: TYPE = DB.AttributeList; -- Global variables and constants MaxVTID: CARDINAL = DBStorage.MaxSystemTupleID; MaxIndexKeyLength: CARDINAL = 200; DefaultNameLength: INT = 12; infString, minfSting: ROPE; desperate: BOOL; -- Set to press on in spite of internal inconsistencies -- Counts for balancing Subset/Release calls: entitySetCount: PUBLIC INT; relshipSetCount: PUBLIC INT; defaultNameHandle: DBStorage.FieldHandle; -- name handle used for all domains w/ default naming: always first field, 18 chars tupleSetNameHandle: DBStorage.FieldHandle; -- this one is used only for tuplesets (whose handle, not name, is first field) attributeNameHandle: DBStorage.FieldHandle; -- this one is used only for attributes (whose name is first field, but is system tuple) defaultNameAttribute: Attribute; -- fake attribute, not really used for much -- Private system properties and relations, used internally and not exported to DB dHandleProp: PUBLIC Attribute; dIndexProp: PUBLIC Attribute; rHandleProp: PUBLIC Attribute; r1to1Prop: PUBLIC Attribute; aHandleProp: PUBLIC Attribute; aTypeCodeProp: PUBLIC Attribute; aTypeEntityProp: PUBLIC Attribute; aDomain: PUBLIC Relation; -- used to form group of attributes targetted to domain by surrogates aDomainOf: PUBLIC Attribute; aDomainIs: PUBLIC Attribute; aUnlinked: PUBLIC Relation; -- used to form group of attributes that reference domain w/o link aUnlinkedOf: PUBLIC Attribute; aUnlinkedIs: PUBLIC Attribute; ifOrdinalPosition: PUBLIC Relation; -- one element per index factor ifOrdinalPositionOf: PUBLIC Attribute; -- the index factor ifOrdinalPositionIs: PUBLIC Attribute; -- INT: ordinal position in indexing -- Definitions of system tuple (virtual) tids NoTID: LONG CARDINAL = 0; -- used in tuple handles nullified by storage level DomainTSID: LONG CARDINAL = 1; RelationTSID: LONG CARDINAL = 2; AttributeTSID: LONG CARDINAL = 3; DataTypeTSID: LONG CARDINAL = 4; IndexTSID: LONG CARDINAL = 5; IndexFactorTSID: LONG CARDINAL = 6; aRelationTSID: LONG CARDINAL = 7; aTypeTSID: LONG CARDINAL = 8; aUniquenessTSID: LONG CARDINAL = 9; aLengthTSID: LONG CARDINAL = 10; aLinkTSID: LONG CARDINAL = 11; aDomainTSID: LONG CARDINAL = 12; aUnlinkedTSID: LONG CARDINAL = 13; ifIndexTSID: LONG CARDINAL = 14; ifOrdinalPositionTSID: LONG CARDINAL = 15; ifAttributeTSID: LONG CARDINAL = 16; dSubTypeTSID: LONG CARDINAL = 17; DummyID: LONG CARDINAL = 19; -- used for one fake relation RopeTypeID: LONG CARDINAL = 20; IntTypeID: LONG CARDINAL = 21; TimeTypeID: LONG CARDINAL = 22; BoolTypeID: LONG CARDINAL = 23; RecordTypeID: LONG CARDINAL = 24; AnyDomainTypeID: LONG CARDINAL = 25; SurrogateRelshipID: LONG CARDINAL = 31; -- used for surrogate relships FirstAttributeID: LONG CARDINAL = 32; -- system attribute ids are 32, 33, ... -- Checking procedures IsSystem: PROC[t: TupleHandle] RETURNS[BOOL] = INLINE {RETURN[t.tid<=DBStorage.MaxSystemTupleID AND t.tid#SurrogateRelshipID] }; IsSurrogate: PROC[t: TupleHandle] RETURNS[BOOL] = INLINE {RETURN[t.tid=SurrogateRelshipID] }; IsData: PROC[t: TupleHandle] RETURNS[BOOL] = INLINE BEGIN IF t.tid=MaxVTID]; END; IsDictionary: PROC[t: TupleHandle] RETURNS[BOOL] = INLINE BEGIN IF t.tid