Annotation of 42BSD/ingres/source/libq/IIn_ret.c, revision 1.1.1.1

1.1       root        1: # include      <ingres.h>
                      2: # include      <symbol.h>
                      3: # include      "IIglobals.h"
                      4: # include      <sccs.h>
                      5: 
                      6: SCCSID(@(#)IIn_ret.c   7.2     10/27/81)
                      7: 
                      8: 
                      9: 
                     10: /*
                     11: **  IIn_ret -- get next domain in a retrieve
                     12: **
                     13: **     Gets the next domain in a retrieve from the data
                     14: **     pipe. If an error occurred previously in the tuple,
                     15: **     will not load the c-var with the value of the domain.
                     16: **     Performs the conversion from the gotten type to
                     17: **     the expected type.
                     18: **
                     19: **     Signals any errors and calls IIerror() accordingly.
                     20: **
                     21: **     Expects the type and length of the next data item in
                     22: **     IIr_sym.
                     23: **
                     24: */
                     25: 
                     26: 
                     27: 
                     28: 
                     29: IIn_ret(addr, type)
                     30: char   *addr;
                     31: int    type;
                     32: {
                     33:        char                    temp[256], *IIitos();
                     34:        char                    *s;
                     35:        register struct retsym  *ret;
                     36:        register                length;
                     37: 
                     38: 
                     39: 
                     40:        if (IIerrflag && IIerrflag != 1001)
                     41:                return;         /* error, no data will be coming, or
                     42:                                 * the rest of the query should be
                     43:                                 * skipped
                     44:                                 */
                     45: 
                     46:         ret = &IIr_sym;
                     47: 
                     48:        if (ret->len &= 0377)
                     49:                if (IIpb_get(&IIpb, temp, ret->len & 0377) != ret->len & 0377)
                     50:                        IIsyserr("IIn_ret: bad pb_get-1 %d", ret->len & 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 opSHORT:
                     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 (IIpb_get(&IIpb, ret, 2) != 2)
                    140:                IIsyserr("IIn_ret : bad pb_get - 2");
                    141: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.