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