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	8.1	12/31/84)
  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:     if ((tty = ttyname(1)) != NULL)
  74:         tty = rindex(tty, '/') + 1;
  75:     pmove((tty != NULL ? tty : " "), Terminal, TTYIDSIZE, ' ');
  76: #	endif
  77:     Terminal[TTYIDSIZE] = '\0';
  78: # ifdef xQTR1
  79:     if (tTf(75, 0))
  80:         printf("Terminal = \"%s\"\n", Terminal);
  81: # endif
  82: }
  83: /*
  84: **  QRYMOD -- main driver for query modification
  85: **
  86: **	Reads in the query tree, performs the modifications, writes
  87: **	it out, and does process syncronization with below.  The
  88: **	calling routine must sync with the process above.
  89: **
  90: **	Parameters:
  91: **		pc -- parameter count (must = 1).
  92: **		pv -- parameter vector:
  93: **			pv[0] -- tree to modify.
  94: **
  95: **	Returns:
  96: **		zero.
  97: **
  98: **	Side Effects:
  99: **		The tree is modified to one that is guaranteed to
 100: **		be directly processable.
 101: **
 102: **	Trace Flags:
 103: **		none.
 104: */
 105: 
 106: 
 107: qrymod(pc, pv)
 108: int pc;
 109: PARM    *pv;
 110: {
 111:     register QTREE  *root;
 112:     extern QTREE    *view(), *integrity(), *protect();
 113: 
 114:     /*
 115: 	**  Get parameters.
 116: 	*/
 117: 
 118:     if (pc != 1)
 119:         syserr("pc=%d", pc);
 120:     if (pv[0].pv_type != PV_QTREE)
 121:         syserr("pv[0].type=%d", pv[0].pv_type);
 122:     root = pv[0].pv_val.pv_qtree;
 123: 
 124:     /* view processing */
 125:     root = view(root);
 126: 
 127:     /* integrity processing */
 128:     root = integrity(root);
 129: 
 130:     /* protection processing */
 131:     root = protect(root);
 132: 
 133:     return (0);
 134: }

Defined functions

qm_init defined in line 56; used 2 times
qrymod defined in line 107; used 2 times

Defined variables

QryModFn defined in line 40; never used
Terminal defined in line 38; used 8 times

Defined macros

TTYIDSIZE defined in line 34; used 5 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1051
Valid CSS Valid XHTML 1.0 Strict