File: DBModel.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Contents: Internal versions of DBModel procs, imported by DBImpl
and exported to DBModel.
Last edited by:
Cattell on: July 21, 1983 2:05 pm
Willie-sue, February 22, 1985 9:21:04 am PST
Donahue, March 10, 1986 8:48:42 am PST
Widom, September 5, 1985 8:50:29 pm PDT
DIRECTORY
DB,
DBCommon,
AlpineEnvironment,
Rope,
DBDefs;
DBModel: CEDAR DEFINITIONS
= BEGIN OPEN DBDefs, DBCommon;
Part 1: Initialization and transaction operations
initialized:
READONLY
BOOL;
This becomes TRUE when Initialize is called
Initialize:
PROC [nCachePages:
NAT, cacheFileName:
ROPE];
OpenTransaction:
PROC [segment: Segment, useTrans: TransactionHandle, eraseAfterOpen:
BOOL ←
FALSE]
RETURNS[trans: TransactionHandle, schemaInvalid:
BOOL];
MarkTransaction: PROC [trans: TransactionHandle];
AbortTransaction: PROC [trans: TransactionHandle];
CloseTransaction: PROC [trans: TransactionHandle];
MakeTransHandle: PROC[trans: DBCommon.Transaction] RETURNS[handle: TransactionHandle];
DeclareSegment:
PROC [filePath:
ROPE, segment: Segment, number: DBCommon.SegmentIndex, lock: AlpineEnvironment.LockOption, readonly:
BOOL, createIfNotFound:
BOOL, nPagesInitial, nPagesPerExtent:
INT];
EraseSegment: PROC [segment: Segment, useTrans: TransactionHandle] RETURNS [trans: TransactionHandle];
GetSegmentInfo: PROC [segment: Segment] RETURNS [filePath: ROPE, readOnly: BOOL];
TransactionForSegment: PROC [segment: Segment] RETURNS [trans: TransactionHandle];
CacheKey:
PROC[segment: Segment]
RETURNS[key:
INT];
The current value of the Model level cache key (which is changed only when the cache must be flushed because it is possibly inconsistent with the database)
Part 2: Domain-definition and -interrogation operations
DeclareDomain:
PROC [name:
ROPE, segment: Segment]
RETURNS [d: Domain];
LookupDomain: PROC[name: ROPE, segment: Segment] RETURNS[d: Domain];
DestroyDomain: PROC [d: Domain];
DomainsByName: PROC [segment: Segment, lowName, highName: ROPE, start: DBCommon.FirstLast] RETURNS[ds: DomainSet];
NextDomain: PROC [ds: DomainSet] RETURNS [Domain];
PrevDomain: PROC [ds: DomainSet] RETURNS [Domain];
ReleaseDomainSet: PROC [ds: DomainSet];
DeclareSubType: PROC [of, is: Domain];
DestroySubType: PROC [of, is: Domain];
SuperType: PROC [d: Domain] RETURNS[super: Domain];
SubTypes: PROC [d: Domain] RETURNS[subs: DomainSet];
TypeForDomain: PROC[d: Domain] RETURNS[type: TypeCode];
Part 3: Relation-definition and -interrogation operations
DeclareRelation:
PROC [name:
ROPE, segment: Segment, fields:
DB.FieldSpec, keys:
LIST
OF Index]
RETURNS[r: Relation];
LookupRelation: PROC[name: ROPE, segment: Segment] RETURNS[r: Relation];
DestroyRelation: PROC [r: Relation];
RelationsByName: PROC [segment: Segment, lowName, highName: ROPE, start: DBCommon.FirstLast] RETURNS[RelationSet];
NextRelation: PROC [rs: RelationSet] RETURNS [Relation];
PrevRelation: PROC [rs: RelationSet] RETURNS [Relation];
ReleaseRelationSet: PROC [rs: RelationSet];
Fields:
PROC[r: Relation]
RETURNS[fieldSpec: DB.FieldSpec];
NameToField: PROC[r: Relation, name: ROPE] RETURNS[exists: BOOL, pos: CARDINAL];
FieldCount: PROC[r: Relation] RETURNS[count: CARDINAL];
FieldInfo: PROC[r: Relation, pos: CARDINAL] RETURNS[field: DB.Field];
DeclareIndex: PROC [r: Relation, index: Index, isKey: BOOL ← FALSE, doCheck: BOOL ← TRUE];
DestroyIndex: PROC[r: Relation, index: Index];
Keys: PROC[r: Relation] RETURNS[keys: LIST OF Index];
Indices: PROC[r: Relation] RETURNS[indices: LIST OF Index];
Part 4: Primitive operations
DeclareEntity:
PROC[d: Domain, name:
ROPE]
RETURNS [e: Entity];
LookupEntity: PROC[d: Domain, name: ROPE] RETURNS[e: Entity];
CreateRelship:
PROC[r: Relation, init: ValueSequence]
RETURNS[t: Relship];
LookupRelship: PROC[r: Relation, key: Index, val: ValueSequence] RETURNS[relship: Relship];
DestroyEntity: PROC[e: Entity];
DestroyRelship: PROC[t: Relship];
SetF:
PROC[t: Relship, field:
CARDINAL, v: Value];
GetF:
PROC[t: Relship, field:
CARDINAL]
RETURNS [Value];
SetP: PROC[e: Entity, r: Relation, field: CARDINAL, v: Value];
GetP: PROC[e: Entity, r: Relation, field: CARDINAL] RETURNS[Value];
EntityInfo: PROC [e: Entity] RETURNS [name: ROPE, domain: Domain];
RelationOf: PROC [t: Relship] RETURNS [Relation];
DomainEq: PROC [d1, d2: Domain] RETURNS[BOOL];
RelationEq: PROC [r1, r2: Relation] RETURNS[BOOL];
AttributeEq: PROC [a1, a2: Attribute] RETURNS[BOOL];
NullDomain: PROC [d: Domain] RETURNS[BOOLEAN];
NullRelation: PROC [r: Relation] RETURNS[BOOLEAN];
NullAttribute: PROC [a: Attribute] RETURNS[BOOLEAN];
Part 5: Aggregate operations
RelationSubset:
PROC [r: Relation, index: Index, constraint: Constraint, start: FirstLast]
RETURNS [RelshipSet];
RelshipsForEntity: PROC [e: Entity] RETURNS [rs: RelshipSet];
RelshipsWithEntityField: PROC[r: Relation, field: CARDINAL, val: Entity] RETURNS[rs: RelshipSet];
NextRelship: PROC [rs: RelshipSet] RETURNS [rship: Relship];
PrevRelship: PROC [rs: RelshipSet] RETURNS [rship: Relship];
ReleaseRelshipSet: PROC [rs: RelshipSet];
DomainSubset:
PROC [d: Domain, lowName, highName:
ROPE, start: DBCommon.FirstLast]
RETURNS [EntitySet];
NextEntity: PROC [es: EntitySet] RETURNS [Entity];
PrevEntity: PROC [es: EntitySet] RETURNS [Entity];
ReleaseEntitySet: PROC [es: EntitySet];
RelationsOf: PROC [d: Domain] RETURNS[rs: RelationSet];
END.