home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / diarel.h < prev    next >
C/C++ Source or Header  |  1993-11-05  |  4KB  |  148 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: diarel.h,v 1.20 1993/10/24 15:05:33 darrenp Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *
  23.  * The diaRel is inherited into application classes to provide database
  24.  * functionality.
  25.  *
  26.  *  Original Author : Daz
  27.  *
  28.  *-------------------------------------------------------------------------
  29.  * Revision History:
  30.  *
  31.  * $Log: diarel.h,v $
  32.  * Revision 1.20  1993/10/24  15:05:33  darrenp
  33.  * Changed the MULTI dependent compilation parts.
  34.  *
  35.  * Revision 1.19  1993/10/18  11:01:26  darrenp
  36.  * Inhibited some code when compiled with MULTI
  37.  *
  38.  * Revision 1.18  1993/10/05  07:33:35  kevinl
  39.  * Now handles dbObjData
  40.  *
  41.  * Revision 1.17  1993/08/29  13:08:35  kevinl
  42.  * Problems with relation assignment
  43.  *
  44.  * Revision 1.16  1993/07/05  05:35:41  darrenp
  45.  * Added MULTI specific includes
  46.  *
  47.  * Revision 1.15  1993/06/23  05:21:22  kevinl
  48.  * Mallocs are now in angular brackets
  49.  *
  50.  * Revision 1.14  1993/05/11  14:44:50  kevinl
  51.  * Added version number output
  52.  *
  53.  * Revision 1.13  1993/05/01  14:40:14  kevinl
  54.  * Stripped ;'s in inlines
  55.  *
  56.  * Revision 1.12  1993/04/27  07:19:18  kevinl
  57.  * Added write
  58.  *
  59.  * Revision 1.11  1993/04/26  01:20:56  kevinl
  60.  * Comments
  61.  *
  62.  * Revision 1.10  1993/04/11  05:49:02  kevinl
  63.  * Rationalised find/seek/peek methods etc
  64.  *
  65.  * Revision 1.9  1993/04/09  13:00:29  kevinl
  66.  * Stats can be called from diaRel now.
  67.  *
  68.  * Revision 1.8  1993/04/04  23:59:17  kevinl
  69.  * destructor to detach
  70.  *
  71.  * Revision 1.7  1993/04/01  04:24:26  kevinl
  72.  * Added/changed transactions
  73.  * Now we have get, extract and find
  74.  *
  75.  * Revision 1.6  1993/03/30  14:38:35  kevinl
  76.  * Modified index passing to database transactions
  77.  *
  78.  * Revision 1.5  1993/03/30  07:39:26  kevinl
  79.  * Made status public
  80.  *
  81.  * Revision 1.4  1993/03/29  23:27:37  kevinl
  82.  * Now holds it's own copy of last error
  83.  *
  84.  * Revision 1.3  1993/03/26  05:49:24  darrenp
  85.  * changed error codes.
  86.  *
  87.  * Revision 1.2  1993/03/24  06:16:38  kevinl
  88.  * Changed constructor to remove pTransferArea
  89.  *
  90.  **************************************************************************/
  91.  
  92. #ifndef __DIAREL__INCL_
  93. #define __DIAREL__INCL_
  94.  
  95. #include <object.h>
  96. #ifdef MULTI
  97. #  include "dclient.h"
  98. class dbObjData;
  99. #else
  100. #  include "dbase.h"
  101. #endif
  102. #include <d_types.h>
  103. #include <dberr.h>
  104.  
  105. char* diaVerStr(void);
  106.  
  107. class diaRel : public object { // protected really
  108.     private:
  109.         long    refId;        // Used for correspondance with server.
  110.     public:
  111.         dbObjData* objData;
  112.         long    getRefId(void) { return refId; }
  113.         char*    verStr(void);
  114.         dbError status;
  115.         virtual    ~diaRel        (void);
  116.         void    perror        (char *);
  117.         dbError    diaErr        (dbError);
  118.                 diaRel        (const char *name);
  119.         dbObjData* getObjData(void) { return objData; }
  120.  
  121.         // operator= must not copy the refId.
  122.         diaRel& operator=(diaRel& X);
  123.  
  124.         // Was the last operation successful
  125.         inline    bool    ok    () { return (bool)(status==db_ok); }
  126.  
  127.         dbError add            (void);
  128.         dbError del            (void);
  129.         dbError put            (void);
  130.         dbError begin        (int idx=0);
  131.         dbError end            (void);
  132.         dbError get            (int idx=0);
  133.         dbError find        (void);
  134.         dbError seek        (void);
  135.         dbError extract        (void);
  136.         dbError seekFirst    (void);
  137.         dbError first        (void);
  138.         dbError seekLast    (void);
  139.         dbError last        (void);
  140.         dbError next        (void);
  141.         dbError peekNext    (void);
  142.         dbError peekPrev    (void);
  143.         dbError prev        (void);
  144.         dbError write        (void);
  145.         void    stats        ();
  146. };
  147. #endif
  148.