Types
Most of these type definitions duplicate those found in the DBDefs and DBCommon interfaces to make things a little less confusing for clients. One day soon these will be turned into opaque definitions (probably) to make the code somewhat more modular
TypeCode: TYPE = DBDefs.TypeCode;
FieldSpec: TYPE = REF FieldSpecObject;
FieldSpecObject: TYPE = RECORD[fields: SEQUENCE count: CARDINAL OF Field];
TypeSpec:
TYPE =
RECORD[ type:
SELECT kind: *
FROM direct => [code: TypeCode], indirect => [ code:
PROC[]
RETURNS [TypeCode] ]
ENDCASE ] ← Any;
Note: type specification may be a nullary procedure (rather than simply being a type code) so that the client can define the fields of a relation before all of the domains that it may depend on have been declared
Field: TYPE = RECORD[name: ROPE, type: TypeSpec, lengthHint: CARDINAL ← 0];
Integer: TypeSpec = [direct[code: DBDefs.intType]];
String: TypeSpec = [direct[code: DBDefs.ropeType]];
Boolean: TypeSpec = [direct[code: DBDefs.boolType]];
Time: TypeSpec = [direct[code: DBDefs.timeType]];
Any: TypeSpec = [direct[code: DBDefs.anyDomainType]];
FieldSequence: TYPE = DBDefs.FieldSequence;
ValueSequence: TYPE = DBDefs.ValueSequence;
Value: TYPE = DBDefs.Value;
Index: TYPE = DBDefs.Index;
Segment: TYPE = DBCommon.Segment;
SegmentList: TYPE = DBCommon.SegmentList;
SegmentIndex: TYPE = DBCommon.SegmentIndex;
FirstLast: TYPE = DBCommon.FirstLast;
TransactionHandle: TYPE = DBCommon.TransactionHandle;
Transaction: TYPE = DBCommon.Transaction;
Domain: TYPE = DBDefs.Domain;
DomainSet: TYPE = DBDefs.DomainSet;
Relation: TYPE = DBDefs.Relation;
RelationSet: TYPE = DBDefs.RelationSet;
Entity: TYPE = DBDefs.Entity;
EntitySet: TYPE = DBDefs.EntitySet;
Relship: TYPE = DBDefs.Relship;
Constraint: TYPE = DBDefs.Constraint;
ValueConstraint: TYPE = DBDefs.ValueConstraint;
RelshipSet: TYPE = DBDefs.RelshipSet;
ErrorCode:
TYPE = {
AlreadyExists, -- DeclareEntity, DeclareRelship: already exists, but version=NewOnly
BadUserPassword, -- Could not authenticate user
CannotDefaultSegment, -- Segment name not built-in to Cypress, and no segment # given
DatabaseNotInitialized, -- Attempt to perform operation without calling DB.Initialize
EntityOrRelshipSetsOpen, -- Excessive Domain/RelationSubsets still open (CloseTransaction).
DirectoryNotFound, -- Directory specified in segment name not found on file server
FileNotFound, -- No existing segment found with given file name, and version=OldOnly
InvalidSchema, -- The domain, relation, or attribute object being used is out of date
IllegalAttribute, -- Attribute not of the given relship's Relation or not attribute
IllegalConstraint, -- Constraint specification had value of incorrect type or had wrong length
IllegalDomain, -- Argument is not actually a domain
IllegalFileName, -- No directory or machine given for segment, or invalid chars in name
IllegalEntity, -- Argument to GetP, or etc., is not an Entity
IllegalIndex,
IllegalKeySpecification, -- A field appears in two or more keys for a relation
IllegalProperty, -- An attempt was made to declare a property relation with a non-entity valued first field
IllegalRelation, -- Argument is not a relation
IllegalString, -- Nulls not allowed in ROPEs passed to the database system
IllegalSuperType, -- Can't define subtype of domain that already has entities
MismatchedAttributeValueType, -- Value not same type as required (SetF)
MismatchedExistingRelation, -- Existing relation is different (DeclareRelation)
MismatchedExistingSegment, -- Existing segment has different # or name
MismatchedValueType,
MultipleMatch, -- More than one relationship satisfied avl on DeclareRelship.
NonUniqueEntityName, -- Entity in domain with that name already exists
NonUniqueKeyValue, -- Relship already exists with same value for a key attribute
NotFound, -- Version is OldOnly but no such Entity, Relation, or etc found
NotImplemented, -- Action requested is not currently implemented
NILArgument, -- Attempt to perform operation on NIL argument
NullifiedArgument, -- Entity or relationship has been deleted, or invalidated by trans abort
ProtectionViolation, -- Read or write to segment file not permitted this user.
QuotaExceeded, -- Database too big for Alpine page quota of segment's directory
SegmentNotDeclared, -- Attempt to open transaction on segment with no DeclareSegment
ServerNotFound, -- File server does not exist or does not respond
TransactionNotOpen, -- Attempt to perform operation with no transaction open
TransactionAlreadyOpen, -- Attempt to open transaction on segment already associated w/one
WriteNotAllowed, -- Attempt to write data but DeclareSegment specified read-only
WrongNumberOfFields, -- attempt to create relship with ill-formed list of initial values
Unknown -- Unknown or not yet assigned error code
};