1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
include "cqdef.h"
include "cq.h"
# CQ_RSTATI -- Get an integer results parameter.
int procedure cq_rstati (res, param)
pointer res #I pointer to the results descriptor
int param #I the integer parameter to be retrieved
begin
switch (param) {
case CQRNQPARS:
return (CQ_RNQPARS(res))
case CQRTYPE:
return (CQ_RTYPE(res))
case CQRNRECS:
return (CQ_RNRECS(res))
case CQRECSIZE:
return (CQ_RECSIZE(res))
case CQRHSKIP:
return (CQ_RHSKIP(res))
case CQRTSKIP:
return (CQ_RTSKIP(res))
case CQRTRIML:
return (CQ_RTRIML(res))
case CQRTRIMR:
return (CQ_RTRIMR(res))
case CQNHEADER:
return (CQ_NHEADER(res))
case CQNFIELDS:
return (CQ_NFIELDS(res))
case CQRECPTR:
return (CQ_RECPTR(res))
default:
call error (0, "Error fetching integer results parameter")
}
end
# CQ_RSTATR -- Get a real results parameter.
real procedure cq_rstatr (res, param)
pointer res #I pointer to the results descriptor
int param #I the real parameter to be retrieved
begin
switch (param) {
default:
call error (0, "Error fetching real results parameter")
}
end
# CQ_RSTATD -- Get a double precision results parameter.
double procedure cq_rstatd (res, param)
pointer res #I pointer to the results descriptor
int param #I the double parameter to be retrieved
begin
switch (param) {
default:
call error (0, "Error fetching double results parameter")
}
end
# CQ_RSTATS -- Get a string results parameter.
procedure cq_rstats (res, param, str, maxch)
pointer res #I pointer to the results descriptor
int param #I the string parameter to be retrieved
char str[ARB] #O the output string parameter
int maxch #I the maximum size of the string parameter
begin
switch (param) {
case CQRCATDB:
call strcpy (CQ_RCATDB(res), str, maxch)
case CQRCATNAME:
call strcpy (CQ_RCATNAME(res), str, maxch)
case CQRADDRESS:
call strcpy (CQ_RADDRESS(res), str, maxch)
case CQRQUERY:
call strcpy (CQ_RQUERY(res), str, maxch)
case CQRQPNAMES:
call strcpy (Memc[CQ_RQPNAMES(res)], str, maxch)
case CQRQPVALUES:
call strcpy (Memc[CQ_RQPVALUES(res)], str, maxch)
case CQRQPUNITS:
call strcpy (Memc[CQ_RQPUNITS(res)], str, maxch)
default:
call error (0, "Error fetching string results parameter")
}
end
# CQ_RSTATT -- Get a text list results parameter. A text list is a
# string with items separated from each other by newlines.
int procedure cq_rstatt (res, param, str, maxch)
pointer res #I pointer to the results descriptor
int param #I the list parameter to be retrieved
char str[ARB] #O the output string parameter
int maxch #I the maximum size of the string parameter
pointer sp, tstr
int i, fd
int stropen(), cq_wrdstr()
begin
switch (param) {
case CQRQPNAMES:
call smark (sp)
call salloc (tstr, CQ_SZ_QPNAME, TY_CHAR)
fd = stropen (str, maxch, NEW_FILE)
str[1] = EOS
do i = 1, CQ_RNQPARS(res) {
if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPNAME,
Memc[CQ_RQPNAMES(res)]) > 0) {
call fprintf (fd, "%s\n")
call pargstr (Memc[tstr])
}
}
call close (fd)
call sfree (sp)
return (CQ_RNQPARS(res))
case CQRQPVALUES:
call smark (sp)
call salloc (tstr, CQ_SZ_QPVALUE, TY_CHAR)
fd = stropen (str, maxch, NEW_FILE)
str[1] = EOS
do i = 1, CQ_RNQPARS(res) {
if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPVALUE,
Memc[CQ_RQPVALUES(res)]) > 0) {
call fprintf (fd, "%s\n")
call pargstr (Memc[tstr])
}
}
call close (fd)
call sfree (sp)
return (CQ_RNQPARS(res))
case CQRQPUNITS:
call smark (sp)
call salloc (tstr, CQ_SZ_QPUNITS, TY_CHAR)
fd = stropen (str, maxch, NEW_FILE)
str[1] = EOS
do i = 1, CQ_RNQPARS(res) {
if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPUNITS,
Memc[CQ_RQPUNITS(res)]) > 0) {
call fprintf (fd, "%s\n")
call pargstr (Memc[tstr])
}
}
call close (fd)
call sfree (sp)
return (CQ_RNQPARS(res))
default:
call error (0, "Error fetching list results parameter")
}
end
|