(******************************************************************************
*                                DATA21  .DEF                                 *
*                              ABO Software Dep.                              *
* Purpose : To provide a simple relational database class                     *
*                                                                             *
*   Notes :                                                                   *
*                                                                             *
*         Version Date : 21/5/92                                              *
******************************************************************************)
DEFINITION MODULE DATA21;

FROM FIO IMPORT File;
FROM OBJ11 IMPORT Object;

CONST
	DBSize = 400;

TYPE
	TuplePtr    = POINTER TO Tuple;
	DBasePtr    = POINTER TO DBase;

CLASS Tuple(Object);
VIRTUAL PROCEDURE eq(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE lt(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE gt(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
VIRTUAL PROCEDURE wrheader(f:File);
VIRTUAL PROCEDURE rdheader(f:File);
END Tuple;

CLASS DBase(Object);
	number:INTEGER;
	tuples:ARRAY[1..DBSize] OF TuplePtr;
PROCEDURE get(id:CARDINAL):TuplePtr;
PROCEDURE sort;
PROCEDURE ins(VAR tp:Tuple);
PROCEDURE del(VAR tp:TuplePtr);
PROCEDURE find(VAR tp:Tuple):TuplePtr;
PROCEDURE selecteq(VAR tp:Tuple;VAR db:DBase);
PROCEDURE selectne(VAR tp:Tuple;VAR db:DBase);
PROCEDURE selectlt(VAR tp:Tuple;VAR db:DBase);
PROCEDURE selectgt(VAR tp:Tuple;VAR db:DBase);
PROCEDURE selectle(VAR tp:Tuple;VAR db:DBase);
PROCEDURE selectge(VAR tp:Tuple;VAR db:DBase);
PROCEDURE union(VAR db1,db2:DBase);
PROCEDURE rd(f:File;VAR t:Tuple);
PROCEDURE wr(f:File);
VIRTUAL PROCEDURE clear;
END DBase;


END DATA21.