# 2.11BSD#431 - /usr/ingres/source/access/compare.c

##### Functions

    icompare          X
    kcompare          X

       1: # include   "../ingres.h"
       2: # include   "../access.h"
       3: # include   "../symbol.h"
       4: # include   "../aux.h"
       5:
       6: icompare(ax, bx, frmt, frml)
       7: char    *ax, *bx, frmt, frml;
       8: {
       9:     register char   *a, *b;
      10:     register int    length;
      11:     int     atemp[4], btemp[4];
      12:
      13:     length = frml & I1MASK;
      14:     if (frmt == CHAR)
      15:         return (scompare(ax, length, bx, length));
      16:     a = (char *) atemp;
      17:     b = (char *) btemp;
      18:     bmove(ax, a, length);
      19:     bmove(bx, b, length);
      20:     if (bequal(a, b, length))
      21:         return (0);
      22:     switch (frmt)
      23:     {
      24:       case INT:
      25:         switch (length)
      26:         {
      27:           case 1:
      28:             return (i1deref(a) - i1deref(b));
      29:           case 2:
      30:             return (i2deref(a) - i2deref(b));
      31:           case 4:
      32:             return (i4deref(a) > i4deref(b) ? 1 : -1);
      33:         };
      34:       case FLOAT:
      35:         if (frml == 4)
      36:         {
      37:             return (f4deref(a) > f4deref(b) ? 1 : -1);
      38:         }
      39:         else
      40:         {
      41:             return (f8deref(a) > f8deref(b) ? 1 : -1);
      42:         }
      43:     };
      44: }
      45:
      46:
      47: kcompare (dx, tuple, key)
      48: struct descriptor   *dx;    /*relation descriptor	*/
      49: char    tuple[MAXTUP];      /*tuple to be compared	*/
      50: char    key[MAXTUP];        /*second tuple or key	*/
      51: /*
      52:  * compares all domains indicated by SETKEY in the tuple to the
      53:  * corressponding domains in the key.
      54:  * the comparison is done according to the format of the domain
      55:  * as specified in the descriptor.
      56:  *
      57:  * function values:
      58:  *	<0 tuple < key
      59:  * 	=0 tuple = key
      60:  *	>0 tuple > key
      61:  *
      62:  */
      63: {
      64:     register int            i, tmp;
      65:     register struct descriptor  *d;
      66:
      67:     d = dx;
      68:     for (i = 1; i <= d->relatts; i++)
      69:         if (d->relgiven[i])
      70:             if (tmp = icompare(&tuple[d->reloff[i]],
      71:                     &key[d->reloff[i]],
      72:                     d->relfrmt[i],
      73:                 d->relfrml[i]))
      74:             {
      75:                 return (tmp);
      76:             }
      77:     return (0);
      78: }

#### Defined functions

icompare defined in line 6; used 5 times

- in line 70
- in /usr/ingres/source/access/ndxsearch.c line 110, 134
- in /usr/ingres/source/access/replace.c line 97
- in /usr/ingres/source/ovqp/key.c line 342

kcompare defined in line 47; used 17 times

- in /usr/ingres/source/access/getequal.c line 47
- in /usr/ingres/source/dbu/display.c line 313
- in /usr/ingres/source/dbu/get_seq_atts.c line 91
- in /usr/ingres/source/dbu/modify.c line 733, 994
- in /usr/ingres/source/dbu/pr_prot.c line 153
- in /usr/ingres/source/dbu/purgetup.c line 33
- in /usr/ingres/source/dbu/rmqm.c line 458, 601
- in /usr/ingres/source/dbu/userdestroy.c line 94
- in /usr/ingres/source/parser/xdot.c line 47
- in /usr/ingres/source/qrymod/integrity.c line 132
- in /usr/ingres/source/qrymod/protect.c line 488
- in /usr/ingres/source/support/restore.c line 563, 712, 758, 802

Last modified: 1995-02-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 508 |