home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / iutil / paramd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-02-08  |  1.5 KB  |  98 lines

  1. # include    <ingres.h>
  2. # include    <aux.h>
  3. # include    <catalog.h>
  4. # include    <access.h>
  5. # include    <sccs.h>
  6.  
  7. SCCSID(@(#)paramd.c    8.2    2/8/85)
  8.  
  9.  
  10.  
  11. /*
  12. **    PARAMD - get access parameters of a relation from its descriptor    
  13. **        and return them in struct pointed to by "ap".
  14. **
  15. **    Parameters:
  16. **        d - descriptor
  17. **        ap - struct which holds the parameters
  18. **
  19. **    Return Codes:
  20. **            0
  21. **
  22. */
  23.  
  24. paramd(d, ap)
  25. register DESC            *d;
  26. register struct accessparam    *ap;
  27. {
  28.     register int    i;
  29.     int        p;
  30.  
  31.  
  32.     ap->mode = getmode(d->reldum.relspec);
  33.     ap->sec_index = FALSE;    /* indicate that this isn't the index-rel */
  34.  
  35.     for (i = 0; i < MAXDOM+1; i++)
  36.         ap->keydno[i] = 0;
  37.  
  38.     for (p = 1; p <= d->reldum.relatts; p++)
  39.         if (i = d->relxtra[p])
  40.             ap->keydno[i-1] = p;
  41.     return (0);
  42. }
  43.  
  44.  
  45. /*
  46. **    PARAMI -get indexes of a relation from  the index struct
  47. **        and place them in the structure pointed to by param
  48. **
  49. **    Parameters:
  50. **        ip - index struct
  51. **        param - holds info about indexes
  52. **
  53. **    Return Codes:
  54. **        0 -- successful
  55. **
  56. */
  57. parami(ip, param)
  58. struct index        *ip;
  59. struct accessparam    *param;
  60. {
  61.     register struct accessparam    *ap;
  62.  
  63.     ap  = param;
  64.     ap->mode = getmode(ip->irelspeci);
  65.     ap->sec_index = TRUE;    /* this is an index */
  66.  
  67.     bmove(ip->idom, ap->keydno, MAXKEYS);
  68.     ap->keydno[MAXKEYS] = 0;
  69.     return(0);
  70. }
  71.  
  72. /*
  73. **     GETMODE - get the mode of the storage type    
  74. **
  75. **    Parameters:
  76. **        spec - storage type
  77. **
  78. */
  79.  
  80. getmode(spec)
  81. int    spec;
  82. {
  83.     switch (abs(spec))
  84.     {
  85.       case M_HEAP:
  86.         return(NOKEY);
  87.  
  88.       case M_ISAM:
  89.         return(LRANGEKEY);
  90.  
  91.       case M_HASH:
  92.         return(EXACTKEY);
  93.  
  94.       default: 
  95.         syserr("getmode:bad relspec %d", spec);
  96.     }
  97. }
  98.