Mapper
get_sensor_list.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 extern _SQCURSOR *_iqnprep();
3 static char *_Cn1 = "sensorcursor"; static _SQCURSOR *_SQ1 = 0;
4 #line 1 "get_sensor_list.ec"
5 #include "prototypes.h"
6 /*
7  * EXEC SQL include sqlca.h;
8  */
9 #line 2 "get_sensor_list.ec"
10 #line 1 "/usr/informix/incl/esql/sqlca.h"
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 #ifndef SQLCA_INCL
37 
38 #define SQLCA_INCL
39 
40 struct sqlca_s
41  {
42  long sqlcode;
43  char sqlerrm[72];
44  char sqlerrp[8];
45  long sqlerrd[6];
46 
47 
48 
49 
50 
51 
52  struct sqlcaw_s
53  {
54  char sqlwarn0;
55  char sqlwarn1;
56 
57  char sqlwarn2;
58 
59  char sqlwarn3;
60 
61  char sqlwarn4;
62 
63  char sqlwarn5;
64  char sqlwarn6;
65  char sqlwarn7;
66  } sqlwarn;
67  };
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 #ifdef VMS
78 noshare
79 #endif
80 extern struct sqlca_s sqlca;
81 
82 extern long SQLCODE;
83 
84 #define SQLNOTFOUND 100
85 
86 #endif
87 #line 3 "get_sensor_list.ec"
88 int get_sensor_list(char *hb5,struct sens_rec *sens_record)
89 
90 {
91 
92 int i,j;
93 extern int dbase;
94 
95 /*
96  * EXEC SQL BEGIN DECLARE SECTION;
97  */
98 #line 10 "get_sensor_list.ec"
99 
100 extern char astring[50];
101 extern struct eens_rec
102  {
103  char id[6];
104  char pe1[2];
105  char pe2[2];
106  char dur[2];
107  char t[2];
108  char s[2];
109  char e[2];
110  char p[2];
111  char type[2];
112  char des[51];
113  char det[41];
114  int post;
115  char new_report[2];
116  char active[2];
117  char ok[2];
118  char rfs[2];
119  int obstime;
120  char prod[10];
121  char prod2ary[10];
122  char obsag[7];
123  char obsloc[4];
124  char prov_avail[2];
125  char final_avail[8];
126  char ownag[7];
127  char ownloc[4];
128  char maintag[7];
129  char maintloc[4];
130  char init[9];
131  char dbsource[4];
132  } bens_rec;
133 /*
134  * EXEC SQL END DECLARE SECTION;
135  */
136 #line 46 "get_sensor_list.ec"
137 
138 
139 strcpy(astring,hb5);
140 
141 i=0;
142 while(astring[i] != 0)
143  astring[i++]=toupper(astring[i]);
144 
145 /*
146  * EXEC SQL open sensorcursor using: astring;
147  */
148 #line 54 "get_sensor_list.ec"
149  {
150 #line 54 "get_sensor_list.ec"
151  static struct sqlvar_struct _sqibind[] =
152  {
153  { 100, 50, 0, 0, 0, 0, 0, 0, 0 },
154 #line 54 "get_sensor_list.ec"
155  };
156  static struct sqlda _SD0 = { 1, _sqibind, 0, 1, 0 };
157 #line 54 "get_sensor_list.ec"
158  _sqibind[0].sqldata = astring;
159 #line 54 "get_sensor_list.ec"
160  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
161 #line 54 "get_sensor_list.ec"
162  _iqdcopen(_SQ1, &_SD0, (char *)0, (char *)0, 1);
163 #line 54 "get_sensor_list.ec"
164  }
165 
166 if(sqlca.sqlcode < 0)
167  return(sqlca.sqlcode);
168 
169 j=0;
170  for(i=0;i<100;i++) {
171 
172 /*
173  * EXEC SQL fetch sensorcursor into :bens_rec;
174  */
175 #line 62 "get_sensor_list.ec"
176  {
177 #line 62 "get_sensor_list.ec"
178  static struct sqlvar_struct _sqobind[] =
179  {
180  { 100, 6, 0, 0, 0, 0, 0, 0, 0 },
181  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
182  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
183  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
184  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
185  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
186  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
187  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
188  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
189  { 100, 51, 0, 0, 0, 0, 0, 0, 0 },
190  { 100, 41, 0, 0, 0, 0, 0, 0, 0 },
191  { 102, sizeof((bens_rec).post), 0, 0, 0, 0, 0, 0, 0 },
192  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
193  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
194  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
195  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
196  { 102, sizeof((bens_rec).obstime), 0, 0, 0, 0, 0, 0, 0 },
197  { 100, 10, 0, 0, 0, 0, 0, 0, 0 },
198  { 100, 10, 0, 0, 0, 0, 0, 0, 0 },
199  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
200  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
201  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
202  { 100, 8, 0, 0, 0, 0, 0, 0, 0 },
203  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
204  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
205  { 100, 7, 0, 0, 0, 0, 0, 0, 0 },
206  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
207  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
208  { 100, 4, 0, 0, 0, 0, 0, 0, 0 },
209 #line 62 "get_sensor_list.ec"
210  };
211  static struct sqlda _SD0 = { 29, _sqobind, 0, 29, 0 };
212  static _FetchSpec _FS1 = { 0, 1, 0 };
213 #line 62 "get_sensor_list.ec"
214  _sqobind[0].sqldata = (bens_rec).id;
215 #line 62 "get_sensor_list.ec"
216  _sqobind[1].sqldata = (bens_rec).pe1;
217 #line 62 "get_sensor_list.ec"
218  _sqobind[2].sqldata = (bens_rec).pe2;
219 #line 62 "get_sensor_list.ec"
220  _sqobind[3].sqldata = (bens_rec).dur;
221 #line 62 "get_sensor_list.ec"
222  _sqobind[4].sqldata = (bens_rec).t;
223 #line 62 "get_sensor_list.ec"
224  _sqobind[5].sqldata = (bens_rec).s;
225 #line 62 "get_sensor_list.ec"
226  _sqobind[6].sqldata = (bens_rec).e;
227 #line 62 "get_sensor_list.ec"
228  _sqobind[7].sqldata = (bens_rec).p;
229 #line 62 "get_sensor_list.ec"
230  _sqobind[8].sqldata = (bens_rec).type;
231 #line 62 "get_sensor_list.ec"
232  _sqobind[9].sqldata = (bens_rec).des;
233 #line 62 "get_sensor_list.ec"
234  _sqobind[10].sqldata = (bens_rec).det;
235 #line 62 "get_sensor_list.ec"
236  _sqobind[11].sqldata = (char *) &(bens_rec).post;
237 #line 62 "get_sensor_list.ec"
238  _sqobind[12].sqldata = (bens_rec).new_report;
239 #line 62 "get_sensor_list.ec"
240  _sqobind[13].sqldata = (bens_rec).active;
241 #line 62 "get_sensor_list.ec"
242  _sqobind[14].sqldata = (bens_rec).ok;
243 #line 62 "get_sensor_list.ec"
244  _sqobind[15].sqldata = (bens_rec).rfs;
245 #line 62 "get_sensor_list.ec"
246  _sqobind[16].sqldata = (char *) &(bens_rec).obstime;
247 #line 62 "get_sensor_list.ec"
248  _sqobind[17].sqldata = (bens_rec).prod;
249 #line 62 "get_sensor_list.ec"
250  _sqobind[18].sqldata = (bens_rec).prod2ary;
251 #line 62 "get_sensor_list.ec"
252  _sqobind[19].sqldata = (bens_rec).obsag;
253 #line 62 "get_sensor_list.ec"
254  _sqobind[20].sqldata = (bens_rec).obsloc;
255 #line 62 "get_sensor_list.ec"
256  _sqobind[21].sqldata = (bens_rec).prov_avail;
257 #line 62 "get_sensor_list.ec"
258  _sqobind[22].sqldata = (bens_rec).final_avail;
259 #line 62 "get_sensor_list.ec"
260  _sqobind[23].sqldata = (bens_rec).ownag;
261 #line 62 "get_sensor_list.ec"
262  _sqobind[24].sqldata = (bens_rec).ownloc;
263 #line 62 "get_sensor_list.ec"
264  _sqobind[25].sqldata = (bens_rec).maintag;
265 #line 62 "get_sensor_list.ec"
266  _sqobind[26].sqldata = (bens_rec).maintloc;
267 #line 62 "get_sensor_list.ec"
268  _sqobind[27].sqldata = (bens_rec).init;
269 #line 62 "get_sensor_list.ec"
270  _sqobind[28].sqldata = (bens_rec).dbsource;
271 #line 62 "get_sensor_list.ec"
272  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
273 #line 62 "get_sensor_list.ec"
274  _iqcftch(_SQ1, (struct sqlda *)0, &_SD0, (char *)0, &_FS1);
275 #line 62 "get_sensor_list.ec"
276  }
277 
278  if(sqlca.sqlcode < 0)
279  return(sqlca.sqlcode);
280 
281  if(sqlca.sqlcode != 0)
282  break;
283 
284 
285 
286 
287 
288 
289 
290 
291 
292 
293 
294 
295 
296 
297  memcpy(&sens_record[j],&bens_rec,sizeof(struct eens_rec));
298  j++;
299 
300  }
301 
302 /*
303  * EXEC SQL close sensorcursor;
304  */
305 #line 88 "get_sensor_list.ec"
306  {
307 #line 88 "get_sensor_list.ec"
308 #line 88 "get_sensor_list.ec"
309  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
310 #line 88 "get_sensor_list.ec"
311  _iqclose(_SQ1);
312 #line 88 "get_sensor_list.ec"
313  }
314 
315 return(j);
316 
317 
318 }
319 
320 
321 
322 
static int i
long SQLCODE
struct sqlca_s sqlca
int get_sensor_list(char *hb5, struct sens_rec *sens_record)
_SQCURSOR * _iqnprep()
char astring[50]
static _SQCURSOR * _SQ1
static char * _Cn1
int rfs(int)
int j
Definition: mapp2h.h:48
struct database dbase
Definition: mapper.c:121
Definition: misc.h:155
char sqlwarn5
Definition: db.c:65
char sqlwarn3
Definition: db.c:61
char sqlwarn4
Definition: db.c:63
char sqlwarn7
Definition: db.c:67
char sqlwarn1
Definition: db.c:57
char sqlwarn6
Definition: db.c:66
char sqlwarn2
Definition: db.c:59
char sqlwarn0
Definition: db.c:56
Definition: db.c:43
long sqlerrd[6]
Definition: db.c:47
struct sqlca_s::sqlcaw_s sqlwarn
long sqlcode
Definition: db.c:44
char sqlerrm[72]
Definition: db.c:45
char sqlerrp[8]
Definition: db.c:46