DIRECTORY DB, Rope USING [ROPE]; NutOps: CEDAR DEFINITIONS = BEGIN OPEN DB, Rope; IsSystemDomain:PROC[name: Rope.ROPE] RETURNS[BOOLEAN]; IsSystemRelation: PROC[name: Rope.ROPE] RETURNS[BOOLEAN]; IsSystemEntity:PROC[name: Rope.ROPE] RETURNS[BOOLEAN]; AttributesOf: PROC[r: Relation] RETURNS[AttributeList]; FirstAttributeOf: PROC[r: Relation] RETURNS[Attribute]; EntityValued: PROC [a: Attribute] RETURNS[BOOL]; GetUniquenessString: PROC[a: Attribute] RETURNS[ROPE]; RSetSize: PROC[rs: RelshipSet] RETURNS[INT]; GetTuples: PROC[e: Entity, a: Attribute] RETURNS [tl: LIST OF Relship]; GetRelation: PROC[a: Attribute] RETURNS[r: Relation]; GetRefAttributes: PROC[d: Domain] RETURNS[al: LIST OF Attribute]; RemoveAttribute: PROC[a: Attribute, al: AttributeList] RETURNS[AttributeList]; AppendAttributes: PROC [al1, al2: AttributeList] RETURNS [al: AttributeList]; SetUpSegment: PROC[segmentFile: ROPE, seg: DB.Segment, number: NAT_ 0, makeReadOnly: BOOL_ FALSE] RETURNS [readOnly: BOOL]; Outcome: TYPE = {success, abort, error, failure}; Do: PROC[proc: PROC[REF ANY], clientData: REF ANY _ NIL] RETURNS [outcome: Outcome]; TryRestart: PROC[trans: DB.Transaction] RETURNS[success: BOOL, failureReason: ATOM]; SafeNameOf: PROC[e: Entity] RETURNS [s: ROPE]; SafeSegmentOf: PROC[e: EntityOrRelship] RETURNS [s: Segment]; SafeDomainOf: PROC[e: Entity] RETURNS [s: Domain]; END. ZNutOps.mesa useful database utilities Implemented by: NutOpsImpl Created by: Donahue on: January 20, 1983 3:48 pm last edited by: Donahue, July 16, 1984 2:28:56 pm PDT Last Edited by: Willie-sue, February 22, 1983 3:44 pm Last Edited by: Cattell, July 22, 1983 2:59 pm Last Edited by: Widom, June 15, 1984 8:45:05 am PDT Last Edited by: Butler, June 26, 1984 4:30:56 pm PDT ********************************************** Handy DB routines, implemented by NutOpsImpl.mesa (no failures or aborts caught in implementations) ********************************************** Returns list of r's attributes returns AttributesOf[r].first returns TRUE iff the value stored in attribute a should be an entity returns the uniqueness of a: Key, OptionalKey, etc., as a printable string returns the length of rs, and does a ReleaseRelshipSet returns all the tuples that reference e via attribute a finds a's relation returns all the attributes that can reference an entity from domain d destructively removes a from al destructively appends al1 and al2 and returns the result *********************************************** Opening segments and transactions for them *********************************************** Open a transaction on the given segment, if possible. This procedure may fail by raising DB.Error, DB.Failure or DB.Aborted. It is also idempotent, if a transaction is already open, nothing will be done. Evaluates the procedure supplied in an environment where the Aborted, Error and Failed signals that may be raised from DB will be caught and turned into returned values. (This is useful in situations where it is awkward to attempt to recover from a failure.) Attempt to re-open an aborted transaction. Returns DB.NameOf iff e is not NIL, else returns NIL Returns DB.SegmentOf iff e is not NIL, else returns NIL Returns DB.DomainOf iff e is not NIL, else returns NIL Êt˜Jšœ ™ Jšœ™Jšœ™Jšœ0™0Jšœ5™5Jšœ5™5Jšœ.™.Jšœ3™3Jšœ1Ïk™4J˜š ˜ Jšœ˜Jšœœœ˜J˜—Jšœœ œ˜Jš˜J˜Jšœœ˜J˜Jšœ.™.Jšœc™cJšœ.™.J˜Jš Ïnœœ œœœ˜6J˜Jš žœœ œœœ˜9J˜Jš žœœ œœœ˜6J˜šž œœœ˜7Jšœ™J˜—šžœœœ ˜7Jšœ™J˜—šž œœœœ˜0JšœD™DJ˜—šžœœœœ˜6JšœJ™JJ˜—šžœœœœ˜,Jšœ6™6J˜—š ž œœœœœ ˜GJšœ7™7J˜—šž œœœ˜5Jšœ™J˜—š žœœ œœœ ˜AJšœE™EJ˜—šžœœ"œ˜NJšœ™J˜—šžœœœ˜MJšœ8™8J˜—Jšœ/™/Jšœ+™+Jšœ/™/J˜šž œœœœœœœœ œ˜{JšÏc”œ9™ÍJ˜—Jšœ œ$˜1J˜Jšžœœœœœœœœœ˜TJšœ‚™‚J˜š ž œœœœ œœ˜TJšœ*™*J˜—šž œœ œœ˜.Jšœ4™4J˜—šž œœœ˜>Jšœ7™7J˜—šž œœ œ ˜3Jšœ6™6J™—Jšœ˜J˜J˜J˜J˜—…—zH