Annotation of 42BSD/ingres/source/iutil/insert.c, revision 1.1.1.1

1.1       root        1: # include      <ingres.h>
                      2: # include      <access.h>
                      3: # include      <sccs.h>
                      4: 
                      5: SCCSID(@(#)insert.c    7.1     2/5/81)
                      6: 
                      7: /*
                      8: **     INSERT - add a new tuple to a relation
                      9: **
                     10: **     Insert puts a given tuple into a relation in
                     11: **     the "correct" position.
                     12: **
                     13: **     If insert is called with checkdups == TRUE then
                     14: **     the tuple will not be inserted if it is a duplicate
                     15: **     of some already existing tuple. If the relation is a
                     16: **     heap then checkdups is made false.
                     17: **
                     18: **     Tid will be set to the tuple id where the
                     19: **     tuple is placed.
                     20: **
                     21: **     returns:
                     22: **             <0  fatal eror
                     23: **             0   success
                     24: **             1   tuple was a duplicate
                     25: */
                     26: 
                     27: insert(d, tid, tuple, checkdups)
                     28: register DESC  *d;
                     29: register TID   *tid;
                     30: char           *tuple;
                     31: bool           checkdups;
                     32: {
                     33:        register int    i;
                     34:        int             need;
                     35: 
                     36: #      ifdef xATR1
                     37:        if (tTf(24, 0))
                     38:        {
                     39:                printf("insert:%.14s,", d->reldum.relid);
                     40:                dumptid(tid);
                     41:                printup(d, tuple);
                     42:        }
                     43: #      endif
                     44:        /* determine how much space is needed for tuple */
                     45:        need = canonical(d, tuple);
                     46: 
                     47:        /* find the "best" page to place tuple */
                     48:        if (i = findbest(d, tid, tuple, need, checkdups))
                     49:                return (i);
                     50: 
                     51:        /* put tuple in position "tid" */
                     52:        put_tuple(tid, Acctuple, need);
                     53: 
                     54:        d->reladds++;
                     55: 
                     56:        return (0);
                     57: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.