1: # include   "../ingres.h"
   2: # include   "../aux.h"
   3: # include   "../pipes.h"
   4: # include   "../tree.h"
   5: # include   "../symbol.h"
   6: # include   "../access.h"
   7: # include   "decomp.h"
   8: 
   9: int Synconly, Error_flag;
  10: 
  11: char    D_dbu70 = 1;    /* used for loading only. causes call_dbu70 to be loaded
  12: 			** instead of call_dbu.
  13: 			*/
  14: 
  15: call_dbu(code, errflag)
  16: int code;
  17: int errflag;
  18: 
  19: /*
  20: **	Call the appropriate dbu with the arguments
  21: **	given in the globals Pc and Pv. Code is a
  22: **	number identifing which dbu to call. Errflag
  23: **	indicates whether an error return from the dbu
  24: **	is possibly expected.
  25: **
  26: **	If errflag < 0 then call_dbu will not wait for sync.
  27: **	If errflag = 0 then call_dbu will syserr on an error
  28: **	If errflag > 0 then call_dbu will return error value
  29: */
  30: 
  31: {
  32:     struct pipfrmt  pipe;
  33:     register int    i, j;
  34:     register int    (*func)();
  35:     extern char *Pv[];
  36:     extern int  Pc;
  37:     extern int  create(), destroy(), resetrel();
  38: 
  39: #	ifdef xDTR1
  40:     if (tTf(3, 0))
  41:         printf("Calling DBU %d\n", code);
  42:     if (tTf(3, 1))
  43:         prargs(Pc, Pv);
  44: #	endif
  45: 
  46:     switch (code)
  47:     {
  48: 
  49:       case mdCREATE:
  50:         func = &create;
  51:         break;
  52: 
  53:       case mdDESTROY:
  54:         func = &destroy;
  55:         break;
  56: 
  57:       case mdRESETREL:
  58:         func = &resetrel;
  59:         break;
  60: 
  61:       default:
  62:         func = NULL;
  63:     }
  64: 
  65:     if (func != NULL)
  66:     {
  67:         Pv[Pc] = (char *) -1;
  68:         Error_flag = (*func)(Pc, Pv);
  69:         closecatalog(FALSE);
  70:     }
  71:     else
  72:     {
  73:         wrpipe(P_PRIME, &pipe, EXEC_DBU, 0, code);
  74:         i = 0;
  75:         j = Pc;
  76:         while (j--)
  77:             wrpipe(P_NORM, &pipe, W_dbu, Pv[i++], 0);
  78:         wrpipe(P_END, &pipe, W_dbu);
  79: 
  80:         Error_flag = 0;
  81:         if (errflag >= 0)
  82:         {
  83:             Synconly++;
  84:             rdpipe(P_PRIME, &pipe);
  85:             rdpipe(P_SYNC, &pipe, R_dbu);
  86:             Synconly = 0;
  87:         }
  88:     }
  89: 
  90: 
  91:     if (Error_flag && !errflag)
  92:     {
  93:         prargs(Pc, Pv);
  94:         syserr("call_dbu:%d,ret %d", code, Error_flag);
  95:     }
  96:     return (Error_flag);
  97: 
  98: }
  99: 
 100: 
 101: proc_error(s1, rpipnum)
 102: struct pipfrmt  *s1;
 103: int     rpipnum;
 104: 
 105: /*
 106: **	Proc_error is called from rdpipe if an error
 107: **	block is encountered. If Synconly is true then
 108: **	the dbu request was initiated by decomp.
 109: **	Otherwise the error block(s) are passed on up.
 110: */
 111: 
 112: {
 113:     extern int      Synconly, Error_flag;
 114:     register struct pipfrmt *s;
 115:     register int        fd;
 116:     struct pipfrmt      t;
 117: 
 118:     fd = rpipnum;
 119:     s = s1;
 120: 
 121:     if (Synconly)
 122:     {
 123:         Synconly = 0;
 124:         Error_flag = s->err_id;
 125:         rdpipe(P_SYNC, s, fd);      /*  throw away the error message  */
 126:     }
 127:     else
 128:     {
 129:         wrpipe(P_PRIME, &t, s->exec_id, 0, s->func_id);
 130:         t.err_id = s->err_id;
 131: 
 132:         copypipes(s, fd, &t, W_up);
 133:         rdpipe(P_PRIME, s);
 134:     }
 135: }
 136: 
 137: /*
 138: **	SYSTEM RELATION DESCRIPTOR CACHE DEFINITION
 139: **
 140: **	This is defined here to prevent the ovqp definition (if any)
 141: **	from overriding these definitions. This file is a direct
 142: **	steal from ".../source/utility/catalog_desc.c"
 143: */
 144: 
 145: struct descriptor   Reldes;
 146: struct descriptor   Attdes;
 147: struct descriptor   Inddes;
 148: 
 149: 
 150: struct desxx    Desxx[] =
 151: {
 152:     "relation", &Reldes,    &Admin.adreld,
 153:     "attribute",    &Attdes,    &Admin.adattd,
 154:     "indexes",  &Inddes,    0,
 155:     0
 156: };
 157: 
 158: 
 159: /*
 160: **	override definition of userdestroy() for destroy() function.
 161: **	Since destroy is only used by decomp to destroy _SYS relations,
 162: **	userdestroy is not needed.
 163: */
 164: userdestroy()
 165: {
 166:     return;
 167: }

Defined functions

proc_error defined in line 101; never used
userdestroy defined in line 164; never used

Defined variables

Attdes defined in line 146; used 1 times
D_dbu70 defined in line 11; never used
Desxx defined in line 150; never used
Error_flag defined in line 9; used 7 times
Inddes defined in line 147; used 1 times
Reldes defined in line 145; used 1 times
Synconly defined in line 9; used 5 times
Last modified: 1995-04-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3594
Valid CSS Valid XHTML 1.0 Strict