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

1.1       root        1: # include      <ingres.h>
                      2: # include      <aux.h>
                      3: # include      <pv.h>
                      4: # include      <opsys.h>
                      5: # include      <func.h>
                      6: # include      <tree.h>
                      7: # include      "qrymod.h"
                      8: # include      <sccs.h>
                      9: 
                     10: SCCSID(@(#)qrymod.c    7.1     2/5/81)
                     11: 
                     12: 
                     13: /*
                     14: **  QRYMOD -- query modification process
                     15: **
                     16: **     This process modifies queries to implement views, protection,
                     17: **     and integrity.
                     18: **
                     19: **     Return Codes:
                     20: **             standard
                     21: **
                     22: **     Trace Flags:
                     23: **             none.
                     24: */
                     25: 
                     26: 
                     27: 
                     28: DESC           Prodes;         /* protection catalog descriptor */
                     29: DESC           Reldes;         /* relation catalog descriptor */
                     30: DESC           Treedes;        /* tree catalog descriptor */
                     31: DESC           Intdes;         /* integrity catalog descriptor */
                     32: extern int     Equel;          /* equel flag */
                     33: 
                     34: # define TTYIDSIZE     8       /* length of tty id */
                     35: 
                     36: extern qrymod(), qm_init(), null_fn();
                     37: short  tTqm[80];
                     38: char   Terminal[TTYIDSIZE + 1];
                     39: 
                     40: struct fn_def  QryModFn =
                     41: {
                     42:        "QRYMOD",
                     43:        qrymod,
                     44:        qm_init,
                     45:        null_fn,
                     46:        (char *) &Qm,
                     47:        sizeof Qm,
                     48:        tTqm,
                     49:        80,
                     50:        'Q',
                     51:        0,
                     52: };
                     53: 
                     54: 
                     55: 
                     56: qm_init(argc, argv)
                     57: int    argc;
                     58: char   **argv;
                     59: {
                     60: #      ifdef xV7_UNIX
                     61:        extern char     *ttyname();
                     62:        extern char     *rindex();
                     63:        char            *tty;
                     64: #      endif
                     65: 
                     66:        /* determine user's terminal for protection algorithm */
                     67: #      ifndef xV7_UNIX
                     68:        pmove("tty", Terminal, TTYIDSIZE, ' ');
                     69:        Terminal[3] = ttyn(1);
                     70:        if (Terminal[3] == 'x')
                     71:                pmove(" ", Terminal, TTYIDSIZE, ' ');
                     72: #      else
                     73:        tty = rindex(ttyname(1), '/') + 1;
                     74:        pmove((tty != NULL ? tty : " "), Terminal, TTYIDSIZE, ' ');
                     75: #      endif
                     76:        Terminal[TTYIDSIZE] = '\0';
                     77: # ifdef xQTR1
                     78:        if (tTf(75, 0))
                     79:                printf("Terminal = \"%s\"\n", Terminal);
                     80: # endif
                     81: }
                     82: /*
                     83: **  QRYMOD -- main driver for query modification
                     84: **
                     85: **     Reads in the query tree, performs the modifications, writes
                     86: **     it out, and does process syncronization with below.  The
                     87: **     calling routine must sync with the process above.
                     88: **
                     89: **     Parameters:
                     90: **             pc -- parameter count (must = 1).
                     91: **             pv -- parameter vector:
                     92: **                     pv[0] -- tree to modify.
                     93: **
                     94: **     Returns:
                     95: **             zero.
                     96: **
                     97: **     Side Effects:
                     98: **             The tree is modified to one that is guaranteed to
                     99: **             be directly processable.
                    100: **
                    101: **     Trace Flags:
                    102: **             none.
                    103: */
                    104: 
                    105: 
                    106: qrymod(pc, pv)
                    107: int    pc;
                    108: PARM   *pv;
                    109: {
                    110:        register QTREE  *root;
                    111:        extern QTREE    *view(), *integrity(), *protect();
                    112: 
                    113:        /*
                    114:        **  Get parameters.
                    115:        */
                    116: 
                    117:        if (pc != 1)
                    118:                syserr("pc=%d", pc);
                    119:        if (pv[0].pv_type != PV_QTREE)
                    120:                syserr("pv[0].type=%d", pv[0].pv_type);
                    121:        root = pv[0].pv_val.pv_qtree;
                    122: 
                    123:        /* view processing */
                    124:        root = view(root);
                    125: 
                    126:        /* integrity processing */
                    127:        root = integrity(root);
                    128: 
                    129:        /* protection processing */
                    130:        root = protect(root);
                    131: 
                    132:        return (0);
                    133: }

unix.superglobalmegacorp.com

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