1: # include   "ctlmod.h"
   2: # include   <ingres.h>
   3: # include   <aux.h>
   4: # include   <tree.h>
   5: # include   <sccs.h>
   6: 
   7: SCCSID(@(#)init_qt.c	8.1	12/31/84)
   8: 
   9: /*
  10: **  INIT_QT -- initialize query tree
  11: **
  12: **	This routine saves and initializes the global portion
  13: **	of a query tree.  It must be called before doing any
  14: **	creation of a query tree which depends on or modifies
  15: **	the global portion of a query tree.
  16: **
  17: **	The global portion of a query tree includes the range
  18: **	table, the query mode, etc.
  19: **
  20: **	The algorithm for saving the query tree global portion
  21: **	("Qt") is somewhat obscure.  To understand it, it is
  22: **	critical to be clear that every query tree is associated
  23: **	with a context, but not every context is associated with
  24: **	a query tree.  We further constrain that a context
  25: **	is associated with at most one query tree; if more than
  26: **	one is needed in a single context, it is always safe
  27: **	to reuse the previous one.
  28: **
  29: **	When we allocate a new context (in 'initp'), the current
  30: **	Qt (if in use) is associated with the save image of the
  31: **	context.  When we call init_qt, we check to see if such
  32: **	an association exists.  If so, we save Qt, and adjust
  33: **	the old context to point to the save image of Qt.  When
  34: **	we call init_qt again, Qt will be active, but not
  35: **	associated with a context save image; thus, we do not
  36: **	save Qt.  On context restore, if it has a pointer to a
  37: **	saved Qt, we restore that also.
  38: **
  39: **	Parameters:
  40: **		none.
  41: **
  42: **	Returns:
  43: **		none
  44: **
  45: **	Side Effects:
  46: **		Qt possibly gets saved in an area set up by
  47: **			calling malloc.
  48: **
  49: **	Trace Flags:
  50: **		none
  51: */
  52: 
  53: init_qt()
  54: {
  55:     extern char *malloc();
  56:     register char   *p;
  57: 
  58:     /*
  59: 	**  Save Qt if associated with a saved context.
  60: 	*/
  61: 
  62:     if (Qt.qt_ctx != NULL)
  63:     {
  64:         p = malloc(sizeof Qt);
  65:         if (p == NULL)
  66:             syserr("init_qt: no mem");
  67:         bmove((char *)&Qt, p, sizeof Qt);
  68:         ((ctx_t *)Qt.qt_ctx)->ctx_qt = p;
  69:         Qt.qt_ctx = NULL;
  70:     }
  71: 
  72:     /* mark the Qt as active */
  73:     Qt.qt_active++;
  74: }

Defined functions

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