1: # include   "../ingres.h"  /* needed for trace flag */
   2: # include   "../symbol.h"
   3: # include   "../pipes.h"
   4: # include   "ovqp.h"
   5: /*
   6: **	OVQP -- the One Variable Query Processor
   7: **
   8: **	accepts one variable queries from
   9: **	decompostion. Queries are sent as a
  10: **	list arranged in postfix order.
  11: **	OVQP returns one of three
  12: **	possible values for each query:
  13: **
  14: **			EMPTY:	no tuples satisfied the query
  15: **
  16: **			NONEMPTY:	at least one tuple satisfied
  17: **					the query. if the query was
  18: **					a simple aggregate then the
  19: **					aggregate value will immediately
  20: **					follow.
  21: **
  22: **			ERROR (CODE):	A user caused error occured
  23: **					during query processing.
  24: **
  25: **/
  26: 
  27: char    *Ovqpbuf;   /* pointer to buffer area */
  28: 
  29: ovqp()
  30: {
  31:     register int        code;
  32:     extern int      Equel;
  33:     extern long     Accuread, Accuwrite, Accusread;
  34:     char            qrybuf[LBUFSIZE];
  35: 
  36: #	ifdef xOTR1
  37:     if (tTf(27, 0))
  38:         printf("OVQP-	Equel=%d\n", Equel);
  39: #	endif
  40: #	ifdef xOTM
  41:     if (tTf(76, 1))
  42:         timtrace(7, 0);
  43: #	endif
  44: #	ifdef xOTR1
  45:     if (tTf(50, 0))
  46:     {
  47:         Accuread = 0;
  48:         Accuwrite = 0;
  49:         Accusread = 0;
  50:     }
  51: #	endif
  52: 
  53:     Ovqpbuf = qrybuf;   /* global buffer is allocated from stack */
  54: 
  55:     startovqp();
  56: 
  57:     for (;;)
  58:     {
  59:         if (code = getqry())    /* get next logical query */
  60:             break;      /* query processing complete */
  61: 
  62:         /* in certain very rare instances, the strategy
  63: 		** routine will detect the fact that no tuples
  64: 		** can satisfy the qualification. If that case
  65: 		** arrises then no scan need be performed.
  66: 		*/
  67: 
  68:         if (strategy())
  69:         {
  70: #			ifdef xOTM
  71:             if (tTf(76, 2))
  72:                 timtrace(9, 0);
  73: #			endif
  74:             code = scan();  /* scan the relation */
  75: #			ifdef xOTM
  76:             if (tTf(76, 2))
  77:                 timtrace(10, 0);
  78: #			endif
  79:         }
  80:         else
  81:             code = EMPTY;   /* else query is false */
  82: 
  83:         retdecomp(code);    /* return result to decomp */
  84:     }
  85: #	ifdef xOTM
  86:     if (tTf(76, 1))
  87:         timtrace(8, 0);
  88: #	endif
  89: 
  90:     endqry(code);   /* close all relations */
  91: 
  92: #	ifdef xOTR1
  93:     if (tTf(50, 1))
  94:     {
  95:         printf("OVQP read %s pages,", locv(Accuread));
  96:         printf("%s catalog pages,", locv(Accusread));
  97:         printf("wrote %s pages\n", locv(Accuwrite));
  98:     }
  99: #	endif
 100: }

Defined functions

ovqp defined in line 29; used 1 times

Defined variables

Ovqpbuf defined in line 27; used 3 times
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2915
Valid CSS Valid XHTML 1.0 Strict