1: # include   <ingres.h>
   2: # include   <aux.h>
   3: # include   <tree.h>
   4: # include   <symbol.h>
   5: # include   <catalog.h>
   6: # include   <pv.h>
   7: # include   <func.h>
   8: # include   "qrymod.h"
   9: # include   <sccs.h>
  10: 
  11: SCCSID(@(#)d_view.c	8.1	12/31/84)
  12: 
  13: 
  14: 
  15: /*
  16: **  D_VIEW -- define view
  17: **
  18: **	This procedure connects the tree in with the relation catalog
  19: **	and inserts the view tree into the tree catalog.
  20: **
  21: **	The information in the pipe is expected to come as follows:
  22: **		create for view, with S_VIEW bit set so that a
  23: **			physical relation is not created.
  24: **		define tree, which will put the translation tree
  25: **			into the 'tree' catalog.
  26: **		define view, which will connect the two together.
  27: **			The first two absolutely must be done before
  28: **			this step can be called.
  29: **
  30: **	Parameters:
  31: **		none
  32: **
  33: **	Returns:
  34: **		none
  35: **
  36: **	Side Effects:
  37: **		I/O in 'tree' catalog.
  38: **
  39: **	Trace Flags:
  40: **		39
  41: */
  42: 
  43: extern DESC Reldes;
  44: 
  45: extern      d_view(), null_fn();
  46: extern short    tTqm[80];
  47: 
  48: struct fn_def   DefViewFn =
  49: {
  50:     "DVIEW",
  51:     d_view,
  52:     null_fn,
  53:     null_fn,
  54:     NULL,
  55:     0,
  56:     tTqm,
  57:     80,
  58:     'Q',
  59:     0
  60: };
  61: 
  62: 
  63: 
  64: 
  65: d_view(pc, pv)
  66: int pc;
  67: PARM    *pv;
  68: {
  69:     char        viewid[MAXNAME + 1];
  70:     struct relation relkey, reltup;
  71:     register QTREE  *t;
  72:     register int    i;
  73:     struct tup_id   tid;
  74:     int     treeid;
  75: 
  76:     /*
  77: 	**  Read parameters.
  78: 	*/
  79: 
  80:     if (pv->pv_type != PV_STR)
  81:         syserr("d_view: viewid");
  82:     pmove(pv->pv_val.pv_str, viewid, MAXNAME, ' ');
  83:     pv++;
  84: 
  85:     if (pv->pv_type != PV_QTREE)
  86:         syserr("d_view: tree");
  87:     t = (QTREE *) pv->pv_val.pv_qtree;
  88:     pv++;
  89: 
  90: #	ifdef xQTR3
  91:     /* do some extra validation */
  92:     if (Qt.qt_qmode != mdVIEW)
  93:         syserr("d_view: Qt.qt_qmode %d", Qt.qt_qmode);
  94:     if (Qt.qt_resvar < 0)
  95:         syserr("d_view: Rv %d", Qt.qt_resvar);
  96:     if (Qt.qt_rangev[Qt.qt_resvar].rngvdesc == NULL ||
  97:         !bequal(Qt.qt_rangev[Qt.qt_resvar].rngvdesc->reldum.relid, viewid, MAXNAME))
  98:         syserr("d_view: rangev %d %.14s", Qt.qt_rangev[Qt.qt_resvar].rngvdesc,
  99:             Qt.qt_rangev[Qt.qt_resvar].rngvdesc->reldum.relid);
 100: #	endif
 101: 
 102:     declare(Qt.qt_resvar, NULL);
 103:     Qt.qt_resvar = -1;
 104:     Qt.qt_qmode = -1;
 105: 
 106:     /* output tree to tree catalog */
 107:     treeid = puttree(t, viewid, Usercode, mdVIEW);
 108: }

Defined functions

d_view defined in line 65; used 2 times

Defined variables

DefViewFn defined in line 48; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 926
Valid CSS Valid XHTML 1.0 Strict