<> <> <> <> <> <> <> <> <> <> <> DIRECTORY BasicTime USING[GMT, nullGMT], CardTable USING[Ref], DBCommon, DBStorage, SymTab USING[Ref], Rope; DBDefs: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; Datum: TYPE = {boolean, integer, rope, time}; <> Type: TYPE = {null, boolean, integer, rope, time, entity}; TypeCode: TYPE = RECORD[code: DBCommon.TID _ 0]; <> <> boolType: TypeCode = TypeCode[code: ORD[Type[boolean]]]; intType: TypeCode = TypeCode[code: ORD[Type[integer]]]; ropeType: TypeCode = TypeCode[code: ORD[Type[rope]]]; timeType: TypeCode = TypeCode[code: ORD[Type[time]]]; anyDomainType: TypeCode = TypeCode[code: ORD[Type[null]]]; <> IsPrimitive: PROC[type: TypeCode] RETURNS[yes: BOOL] = INLINE { yes _ type.code IN [ ORD[Type[boolean]] .. ORD[Type[time]] ] }; Value: TYPE = RECORD [SELECT type: Type FROM boolean => [value: BOOL], integer => [value: INT], entity => [value: Entity], rope => [value: ROPE], time => [value: BasicTime.GMT], null => [], ENDCASE]; NullValue: Value = Value[null[]]; ValueSequence: TYPE = REF ValueSequenceObject; ValueSequenceObject: TYPE = RECORD[SEQUENCE count: CARDINAL OF Value]; <> Index: TYPE = REF IndexObject; IndexObject: TYPE = RECORD[ fields: FieldSequence, key: CARDINAL _ 0, isKey: BOOL _ FALSE, index: DBCommon.TupleHandle _ NIL ]; <> FieldSequence: TYPE = REF FieldSequenceObject; FieldSequenceObject: TYPE = RECORD[SEQUENCE count: CARDINAL OF CARDINAL]; <> Domain: TYPE = REF DomainObject; Relation: TYPE = REF RelationObject; Attribute: TYPE = REF AttributeHandle; AttributeHandle: TYPE = RECORD[pos: CARDINAL, relation: Relation]; <> Entity: TYPE = REF EntityObject; EntityObject: TYPE = RECORD[domain: Domain, name: Rope.ROPE, tuple: DBCommon.TupleHandle]; <> NullEntity: Entity = NIL; <> TupleSet: TYPE = DBCommon.TupleHandle; Relship: TYPE = REF RelshipObject; RelshipObject: TYPE = RECORD[ relation: Relation, handle: DBCommon.TupleHandle ]; <> <> <<>> <> SegmentHandle: TYPE = REF SegmentObject; SegmentObject: TYPE = RECORD [ segment: Segment, <> server: Rope.ROPE, <> key: CARDINAL _ 0, <> cacheTrashed: BOOL _ TRUE, <> indices: ARRAY[0..DBCommon.systemIndexCount) OF DBCommon.TupleHandle, <> domainTable, relationTable: SymTab.Ref, <> <> <> domainsByTID: CardTable.Ref, <> attributeTable: CardTable.Ref, <> schemaVersionStamp: INT _ 0, <> schemaUpdated: BOOL _ FALSE <> ]; DomainObject: TYPE = RECORD [ name: ROPE, <> segment: Segment, <> key: CARDINAL, <> tupleSet: DBCommon.TupleHandle, <> detailsKnown: BOOL _ FALSE, <> index: DBCommon.TupleHandle, <> entityNameHandle: DBStorage.FieldHandle _ NIL, <> superTypeKnown: BOOL _ FALSE, <> superType: Domain, <> surrogatesKnown: BOOL _ FALSE, <> surrogates: RelationList <> ]; RelationList: TYPE = REF RelationListObject; RelationListObject: TYPE = RECORD[relation: Relation, next: RelationList _ NIL]; RelationObject: TYPE = RECORD [ name: ROPE, <> segment: Segment, <> key: CARDINAL, <> tupleSet: DBCommon.TupleHandle, <> attributesKnown: BOOL _ FALSE, <> isProperty: BOOL _ FALSE, <> isSurrogate: BOOL _ FALSE, <> surrogateDomain: Domain _ NIL, <> surrogateGroupHandle: DBStorage.FieldHandle _ NIL, <> attributes: AttrSeqHandle, <> indicesKnown: BOOL _ FALSE, <> keys: LIST OF IndexHandle, <> indices: LIST OF IndexHandle <> ]; AttrSeqHandle: TYPE = REF AttributeSequence; AttributeSequence: TYPE = RECORD[ SEQUENCE count: CARDINAL OF REF AttributeObject ]; <> AttributeObject: TYPE = RECORD [ name: ROPE, <> type: TypeCode, <> tuple: DBCommon.TID, <> domain: Domain, <> fh: DBStorage.FieldHandle _ NIL, <> indices: LIST OF IndexHandle <> ]; IndexHandle: TYPE = REF IndexHandleObject; IndexHandleObject: TYPE = RECORD[indexHandle: DBCommon.TupleHandle, isKey: BOOL, index: FieldSequence]; <> RelshipSet: TYPE = REF RelshipSetObject; RopeSequence: TYPE = REF RopeSequenceObject; RopeSequenceObject: TYPE = RECORD[SEQUENCE length: CARDINAL OF Rope.ROPE]; RelshipSetObject: TYPE = RECORD[ relation: Relation, variant: SELECT type: * FROM onlyOne => [tuple: DBCommon.TupleHandle], simpleScan => [scanHandle: DBStorage.IndexScanHandle], tupleSet => [scanHandle: DBStorage.TuplesetScanHandle], group => [scanHandle: DBStorage.GroupScanHandle], complexScan => [handle: REF ComplexScanObject], scanForEntity => [handle: REF EntityScanObject] ENDCASE ]; ComplexScanObject: TYPE = RECORD[low, high, thisOne: RopeSequence, scanHandle: DBStorage.IndexScanHandle]; EntityScanObject: TYPE = RECORD[entityTuple: DBCommon.TupleHandle, fields: LIST OF DBCommon.TupleHandle, relationsAlreadyDone: LIST OF DBCommon.TupleHandle, thisRelation: Relation, scanHandle: DBStorage.GroupScanHandle]; EntitySet: TYPE = REF EntitySetObject; EntitySetObject: TYPE = RECORD[domain: Domain, scanHandle: DBStorage.IndexScanHandle]; DomainSet: TYPE = REF DomainSetObject; RelationSet: TYPE = REF RelationSetObject; DomainSetObject: TYPE = RECORD[segment: Segment, variant: SELECT type:* FROM index => [scanHandle: DBStorage.IndexScanHandle], group => [scanHandle: DBStorage.GroupScanHandle] ENDCASE ]; RelationSetObject: TYPE = RECORD[segment: Segment, variant: SELECT type: * FROM index => [scanHandle: DBStorage.IndexScanHandle], relationsForDomain => [scanHandle: DBStorage.GroupScanHandle, lastTuple: DBCommon.TupleHandle] ENDCASE ]; Constraint: TYPE = REF ConstraintObject; ConstraintObject: TYPE = RECORD[SEQUENCE count: CARDINAL OF ValueConstraint]; ValueConstraint: TYPE = RECORD[SELECT type: Type FROM boolean => [value: BOOL], integer => [low: INT _ FIRST[INT], high: INT _ LAST[INT]], entity => [value: Entity], rope => [low: ROPE _ NIL, high: ROPE _ NIL], time => [low: BasicTime.GMT _ BasicTime.nullGMT , high: BasicTime.GMT _ BasicTime.nullGMT], null => [], ENDCASE ]; <> <<>> Segment: TYPE = DBCommon.Segment; SegmentIndex: TYPE = DBCommon.SegmentIndex; FirstLast: TYPE = DBCommon.FirstLast; END.