1: # include   <stdio.h>
   2: 
   3: # include   "../ingres.h"
   4: # include   "../aux.h"
   5: # include   "../pipes.h"
   6: # include   "monitor.h"
   7: 
   8: /*
   9: **  PROCESS QUERY
  10: **
  11: **	The appropriate messages are printed, and the query is scanned.
  12: **	Tokens are passed to the parser.  A parser response is then
  13: **	expected.
  14: **
  15: **	Uses trace flag 5
  16: **
  17: **	History:
  18: **		3/2/79 (eric) -- {querytrap} stuff installed.
  19: */
  20: 
  21: # define    QRYTRAP     "{querytrap}"
  22: 
  23: 
  24: go()
  25: {
  26:     struct pipfrmt  iobuf;
  27:     FILE        *iop;
  28:     register int    i;
  29:     char        c;
  30:     extern int  fgetc();
  31:     struct retcode  rc;
  32:     register char   *p;
  33:     char        *macro();
  34: 
  35:     clrline(1);
  36:     fflush(Qryiop);
  37:     if ((iop = fopen(Qbname, "r")) == NULL)
  38:         syserr("go: open 1");
  39:     if (Nodayfile >= 0)
  40:         printf("Executing . . .\n\n");
  41: 
  42: #	ifdef xMTM
  43:     if (tTf(76, 1))
  44:         timtrace(3, 0);
  45: #	endif
  46: 
  47:     if (!Nautoclear)
  48:         Autoclear = 1;
  49: 
  50:     wrpipe(P_PRIME, &iobuf, 'M', 0, 0);
  51:     macinit(&fgetc, iop, 1);
  52: 
  53:     while ((c = macgetch()) > 0)
  54:     {
  55:         wrpipe(P_NORM, &iobuf, W_down, &c, 1);
  56:     }
  57: 
  58:     wrpipe(P_END, &iobuf, W_down);
  59:     Error_id = 0;
  60:     rdpipe(P_PRIME, &iobuf);
  61: 
  62:     /* read number of tuples return */
  63:     if (rdpipe(P_NORM, &iobuf, R_down, &rc, sizeof rc) == sizeof rc)
  64:     {
  65:         rc.rc_status = RC_OK;
  66:         macdefine("{tuplecount}", locv(rc.rc_tupcount), TRUE);
  67:     }
  68:     else
  69:         rc.rc_status = RC_BAD;
  70: 
  71:     if (Error_id == 0 && (p = macro(QRYTRAP)) != NULL)
  72:         trapquery(&rc, p);
  73:     /* clear out the rest of the pipe */
  74:     rdpipe(P_SYNC, &iobuf, R_down);
  75: 
  76:     mcall("{continuetrap}");
  77: 
  78: #	ifdef xMTM
  79:     if (tTf(76, 1))
  80:         timtrace(4, 0);
  81: #	endif
  82:     prompt("\ncontinue");
  83:     fclose(iop);
  84: }

Defined functions

go defined in line 24; used 1 times

Defined macros

QRYTRAP defined in line 21; used 1 times
  • in line 71
Last modified: 1995-02-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1272
Valid CSS Valid XHTML 1.0 Strict