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;
93 
94 /*
95  * EXEC SQL BEGIN DECLARE SECTION;
96  */
97 #line 9 "get_sensor_list.ec"
98 
99 extern char astring[50];
100 extern struct eens_rec
101  {
102  char id[6];
103  char pe1[2];
104  char pe2[2];
105  char dur[2];
106  char t[2];
107  char s[2];
108  char e[2];
109  char p[2];
110  int post;
111  char init[9];
112  char ok[2];
113  } bens_rec;
114 /*
115  * EXEC SQL END DECLARE SECTION;
116  */
117 #line 27 "get_sensor_list.ec"
118 
119 
120 strcpy(astring,hb5);
121 
122 i=0;
123 while(astring[i] != 0)
124  astring[i++]=toupper(astring[i]);
125 
126 /*
127  * EXEC SQL open sensorcursor using: astring;
128  */
129 #line 35 "get_sensor_list.ec"
130  {
131 #line 35 "get_sensor_list.ec"
132  static struct sqlvar_struct _sqibind[] =
133  {
134  { 100, 50, 0, 0, 0, 0, 0, 0, 0 },
135 #line 35 "get_sensor_list.ec"
136  };
137  static struct sqlda _SD0 = { 1, _sqibind, 0, 1, 0 };
138 #line 35 "get_sensor_list.ec"
139  _sqibind[0].sqldata = astring;
140 #line 35 "get_sensor_list.ec"
141  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
142 #line 35 "get_sensor_list.ec"
143  _iqdcopen(_SQ1, &_SD0, (char *)0, (char *)0, 1);
144 #line 35 "get_sensor_list.ec"
145  }
146 
147 if(sqlca.sqlcode < 0)
148  return(sqlca.sqlcode);
149 
150  for(i=0;i<50;i++) {
151 
152 /*
153  * EXEC SQL fetch sensorcursor into :bens_rec;
154  */
155 #line 42 "get_sensor_list.ec"
156  {
157 #line 42 "get_sensor_list.ec"
158  static struct sqlvar_struct _sqobind[] =
159  {
160  { 100, 6, 0, 0, 0, 0, 0, 0, 0 },
161  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
162  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
163  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
164  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
165  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
166  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
167  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
168  { 102, sizeof((bens_rec).post), 0, 0, 0, 0, 0, 0, 0 },
169  { 100, 9, 0, 0, 0, 0, 0, 0, 0 },
170  { 100, 2, 0, 0, 0, 0, 0, 0, 0 },
171 #line 42 "get_sensor_list.ec"
172  };
173  static struct sqlda _SD0 = { 11, _sqobind, 0, 11, 0 };
174  static _FetchSpec _FS1 = { 0, 1, 0 };
175 #line 42 "get_sensor_list.ec"
176  _sqobind[0].sqldata = (bens_rec).id;
177 #line 42 "get_sensor_list.ec"
178  _sqobind[1].sqldata = (bens_rec).pe1;
179 #line 42 "get_sensor_list.ec"
180  _sqobind[2].sqldata = (bens_rec).pe2;
181 #line 42 "get_sensor_list.ec"
182  _sqobind[3].sqldata = (bens_rec).dur;
183 #line 42 "get_sensor_list.ec"
184  _sqobind[4].sqldata = (bens_rec).t;
185 #line 42 "get_sensor_list.ec"
186  _sqobind[5].sqldata = (bens_rec).s;
187 #line 42 "get_sensor_list.ec"
188  _sqobind[6].sqldata = (bens_rec).e;
189 #line 42 "get_sensor_list.ec"
190  _sqobind[7].sqldata = (bens_rec).p;
191 #line 42 "get_sensor_list.ec"
192  _sqobind[8].sqldata = (char *) &(bens_rec).post;
193 #line 42 "get_sensor_list.ec"
194  _sqobind[9].sqldata = (bens_rec).init;
195 #line 42 "get_sensor_list.ec"
196  _sqobind[10].sqldata = (bens_rec).ok;
197 #line 42 "get_sensor_list.ec"
198  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
199 #line 42 "get_sensor_list.ec"
200  _iqcftch(_SQ1, (struct sqlda *)0, &_SD0, (char *)0, &_FS1);
201 #line 42 "get_sensor_list.ec"
202  }
203 
204  if(sqlca.sqlcode < 0)
205  return(sqlca.sqlcode);
206 
207  if(sqlca.sqlcode != 0)
208  break;
209 
210  memcpy(&sens_record[i],&bens_rec,sizeof(struct eens_rec));
211 
212  }
213 
214 /*
215  * EXEC SQL close sensorcursor;
216  */
217 #line 54 "get_sensor_list.ec"
218  {
219 #line 54 "get_sensor_list.ec"
220 #line 54 "get_sensor_list.ec"
221  if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 0, 1, 0);
222 #line 54 "get_sensor_list.ec"
223  _iqclose(_SQ1);
224 #line 54 "get_sensor_list.ec"
225  }
226 
227 return(i);
228 
229 
230 }
231 
232 
233 
234 
static int i
long SQLCODE
static _SQCURSOR * _SQ1
struct sqlca_s sqlca
static char * _Cn1
int get_sensor_list(char *hb5, struct sens_rec *sens_record)
_SQCURSOR * _iqnprep()
char astring[50]
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