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

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: diagrel.h,v 1.7 1993/10/28 07:49:01 kevinl 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.  *
  24.  * The diaGRel class is used to provide generalised access to relations
  25.  * without the need for associated compiled comparison code. It effectively
  26.  * sits on top of a diaRel class and provides comparison, load and store 
  27.  * support for the object methods (must inherit an object base class too).
  28.  *
  29.  *  Original Author : Daz
  30.  *
  31.  *-------------------------------------------------------------------------
  32.  * Revision History:
  33.  *
  34.  * $Log: diagrel.h,v $
  35.  * Revision 1.7  1993/10/28  07:49:01  kevinl
  36.  * Added diaGRel dbString/dbData support
  37.  *
  38.  * Revision 1.6  1993/10/18  11:33:17  kevinl
  39.  * Added fieldNum
  40.  *
  41.  * Revision 1.5  1993/10/18  10:59:43  darrenp
  42.  * Moved some things into public
  43.  *
  44.  * Revision 1.4  1993/10/05  07:32:11  kevinl
  45.  * Moved all info out and into dbObj. Made all accesses to relation data
  46.  * via dbObjData pointer.
  47.  *
  48.  * Revision 1.3  1993/09/28  13:04:39  kevinl
  49.  * Can now pass data pointer to constructor
  50.  *
  51.  * Revision 1.2  1993/09/26  23:35:07  darrenp
  52.  * Fixed indexedOn allocation bug, expanded test code.
  53.  *
  54.  */
  55.  
  56. #ifndef DIAGREL_INCL
  57. #define DiAGREL_INCL
  58. #include <diarel.h>
  59. #include <idxinfo.h>
  60.  
  61. #define MFII MAX_FIELDS_IN_INDEX
  62.  
  63. //
  64. // This class provides access to generic relations.
  65. // It uses the diaRel class to define its interface to
  66. // users, and an object to define its responsibility to
  67. // the database engine. It effectively provides an interpretted
  68. // replacement for the DSC generated comparison code.
  69. //
  70.  
  71. class diaGRel : public diaRel {
  72.     private:
  73.         // ----------------------------
  74.         // Methods in object which
  75.         // we must override to fulfill the db engines
  76.         // requests.
  77.         // ----------------------------
  78.         operator     void*();
  79.         virtual    void         getData(void);
  80.         virtual    void         putData(void);
  81.         virtual    void         startData(void);
  82.         virtual    void         endData(void);
  83.         pKeyType     getKey(long keyNum=0);
  84.         bool         hasUnique(void);
  85.         long        getUnique(void);
  86.         void         setUnique(long uniq);
  87.         long         getKeyLength(long keyNum=0);
  88.         void         setKey(pKeyType newKey, long keyNum=0);
  89.         long         compare(pKeyType key, long keyNum=0);
  90.         bool         isUnique(long keyNum=0);
  91.         //dbObjData*    data;
  92.  
  93.         _db_strStruct*    theArray;
  94.         dbData*        getString(long num);
  95.         long*         getLong(long num);
  96.         _db_strStruct* getArray(void);
  97.  
  98.     public:
  99.         long         getDataLength(void); // Public so that 
  100.                                         // we know how long theData is
  101.         long        fieldNum(char* name);
  102.         long*        uniqOffset;        // Pointer into unique in theData
  103.         void        *theData;         // Where we hold the record.
  104.         long         numStrings(void);
  105.                     diaGRel(const char *relName, void* newData = 0);
  106. };
  107. #endif
  108.