1: #
   2: # include   "../../ingres.h"
   3: # include   "../../symbol.h"
   4: # include   "../../pipes.h"
   5: # include   "IIglobals.h"
   6: 
   7: 
   8: /*
   9: **  IIn_ret -- get next domain in a retrieve
  10: **
  11: **	Gets the next domain in a retrieve from the data
  12: **	pipe. If an error occurred previously in the tuple,
  13: **	will not load the c-var with the value of the domain.
  14: **	Performs the conversion from the gotten type to
  15: **	the expected type.
  16: **
  17: **	Signals any errors and calls IIerror() accordingly.
  18: **
  19: **	Expects the type and length of the next data item in
  20: **	IIr_sym.
  21: **
  22: */
  23: 
  24: 
  25: 
  26: 
  27: IIn_ret(addr, type)
  28: char    *addr;
  29: int type;
  30: {
  31:     char            temp[256], *IIitos();
  32:     char            *s;
  33:     register struct retsym  *ret;
  34:     register        length;
  35: 
  36: 
  37: 
  38:     if (IIerrflag && IIerrflag != 1001)
  39:         return;     /* error, no data will be coming, or
  40: 				 * the rest of the query should be
  41: 				 * skipped
  42: 				 */
  43: 
  44:         ret = &IIr_sym;
  45: 
  46:     if (ret->len &= 0377)
  47:         if (IIrdpipe(P_NORM, &IIeinpipe, IIr_front, temp,
  48:             ret->len & 0377) != ret->len & 0377)
  49:             IIsyserr("IIn_ret: bad rdpipe-1 %d", ret->len &
  50:             0377);
  51: 
  52: 
  53: #	ifdef xETR1
  54:     if (IIdebug)
  55:     {
  56:         printf("%s ent ", IIproc_name ? IIproc_name: "");
  57:         printf("IIn_ret : addr 0%o type %d length %d type %d IIerrflag %d\n",
  58:         addr, type, ret->len & 0377, ret->type, IIerrflag);
  59:     }
  60: #	endif
  61: 
  62: 
  63:     IIdomains++;
  64:     switch (type)
  65:     {
  66: 
  67:       case opINT:
  68:         type = INT;
  69:         length = 2;
  70:         break;
  71: 
  72:       case opLONG:
  73:         type = INT;
  74:         length = 4;
  75:         break;
  76: 
  77:       case opFLOAT:
  78:         type = FLOAT;
  79:         length = 4;
  80:         break;
  81: 
  82:       case opDOUBLE:
  83:         type = FLOAT;
  84:         length = 8;
  85:         break;
  86: 
  87:       case opSTRING:
  88:         type = CHAR;
  89:         length = 255;   /* with the current implementation the length is not known */
  90:         break;
  91: 
  92:       default:
  93:         IIsyserr("IIn_ret:bad type %d", type);
  94:     }
  95: 
  96:     switch (ret->type)
  97:     {
  98: 
  99:       case INT:
 100:       case FLOAT:
 101:         if (type == CHAR)
 102:         {
 103:             s = IIitos(IIdomains);
 104:             IIerrflag = 1000;
 105:             IIerror(1000, 1, &s);
 106:             return (0);
 107:         }
 108:         if (IIconvert(temp, IIerrflag ? temp : addr,
 109:            ret->type, ret->len & 0377, type, length) < 0)
 110:         {
 111:                 s = IIitos(IIdomains);
 112:                 IIerrflag = 1001;
 113:                 IIerror(1001, 1, &s);
 114:         }
 115:         break;
 116: 
 117:       case CHAR:
 118:         if (type != CHAR)
 119:         {
 120:             s = IIitos(IIdomains);
 121:             IIerrflag = 1002;
 122:             IIerror(1002, 1, &s);
 123:             return (0);
 124:         }
 125:         if (!IIerrflag)
 126:         {
 127:             IIbmove(temp, addr, ret->len & 0377);
 128: 
 129:             /* null terminate string */
 130:             addr [ret->len & 0377] = '\0';
 131:         }
 132:         break;
 133: 
 134:       default :
 135:         IIsyserr("IIn_ret bad gotten type %d",
 136:         ret->type);
 137:     }
 138: 
 139:     if (IIrdpipe(P_NORM, &IIeinpipe, IIr_front, ret, 2) != 2)
 140:         IIsyserr("IIn_ret : bad rdpipe - 2");
 141: }

Defined functions

IIn_ret defined in line 27; never used
Last modified: 1995-02-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2138
Valid CSS Valid XHTML 1.0 Strict