]> andersk Git - moira.git/blame_incremental - regtape/students.dc
increase QMAXARGS to 22 (max number of args to/from a query
[moira.git] / regtape / students.dc
... / ...
CommitLineData
1/* $Header$
2 */
3
4#include <stdio.h>
5#include <strings.h>
6#include <ctype.h>
7#include <sys/time.h>
8#include <moira.h>
9#include <moira_site.h>
10EXEC SQL INCLUDE sqlca;
11
12
13#define WHO 11859 /* root */
14#define PROG "stu-tape"
15
16#define MAX_ID_VALUE 31999
17#define MIN_ID_VALUE 101
18
19/* File format is:
20
210-29 name
2230-38 id number
2350-54 school code
2455-79 year
2580-109 address
26110-124 room
27125-144 city
28145-158 state
29159-168 dorm phone
30169-212 home address
31213-232 home city
32243-251 mit phone (?)
33*/
34
35#define LOC_NAME 0
36#define LOC_ID 30
37#define LOC_COURSE 50
38#define LOC_YEAR 55
39#define LOC_ADDRESS 80
40#define LOC_DORM_ROOM 110
41#define LOC_CITY 125
42#define LOC_STATE 145
43#define LOC_DPHONE 155
44#define LOC_MPHONE 243
45
46#define LEN_NAME 30
47#define LEN_ID 9
48#define LEN_COURSE 5
49#define LEN_YEAR 25
50#define LEN_ADDRESS 30
51#define LEN_DORM_ROOM 15
52#define LEN_CITY 20
53#define LEN_STATE 10
54#define LEN_DPHONE 12
55#define LEN_MPHONE 12
56
57struct entry {
58 char *name;
59 char *last;
60 char *first;
61 char *middle;
62 char *title;
63 char *id;
64 char *eid;
65 char *course;
66 char *year;
67 char *address;
68 char *dorm;
69 char *city;
70 char *state;
71 char *dphone;
72 char *mphone;
73 char *class;
74};
75
76
77char *whoami;
78int newfinger = 0;
79
80#define SQL_DUPLICATE -40100
81#define SQL_DEADLOCK -49900
82#define sqlfail() (sqlca.sqlcode && sqlca.sqlcode != 100)
83
84main(argc, argv)
85int argc;
86char **argv;
87{
88 FILE *in;
89 struct entry *e, *get_next_entry();
90 int i, wait = 0;
91 char buf[BUFSIZ], *file = NULL;
92
93 whoami = rindex(argv[0], '/');
94 if (whoami)
95 whoami++;
96 else
97 whoami = argv[0];
98
99 for (i = 1; i < argc; i++) {
100 if (!strcmp(argv[i], "-w"))
101 wait++;
102 else if (!strcmp(argv[i], "-D"))
103 setenv("ING_SET", "set printqry");
104 else if (!strcmp(argv[i], "-n"))
105 newfinger++;
106 else if (file != NULL)
107 fprintf(stderr, "Usage: %s [-w] [-D] [-n] inputfile\n", whoami);
108 else
109 file = argv[i];
110 }
111
112 in = fopen(file, "r");
113 if (in == NULL) {
114 fprintf(stderr, "Unable to open %s for input\n", file);
115 exit(1);
116 }
117
118 setlinebuf(stdout);
119 setlinebuf(stderr);
120
121 EXEC SQL CONNECT moira;
122 if (sqlca.sqlcode != 0) {
123 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
124 exit(1);
125 }
126
127 while (e = get_next_entry(in)) {
128 again:
129 process_entry(e);
130 EXEC SQL COMMIT WORK;
131 if (sqlca.sqlcode != 0) {
132 if (sqlca.sqlcode == SQL_DEADLOCK) {
133 com_err(whoami, MR_DEADLOCK, "commiting work");
134 goto again;
135 } else {
136 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
137 exit(1);
138 }
139 }
140 if (wait) {
141 printf("Next");
142 fflush(stdout);
143 gets(buf);
144 }
145 }
146
147 exit(0);
148}
149
150
151struct entry *get_next_entry(in)
152FILE *in;
153{
154 static struct entry e;
155 static char buf[BUFSIZ], eid[16], classbuf[10], titlebuf[12];
156 static char name[LEN_NAME+1], id[LEN_ID+1], course[LEN_COURSE+1];
157 static char year[LEN_YEAR+1], address[LEN_ADDRESS+1];
158 static char dorm_room[LEN_DORM_ROOM+1], city[LEN_CITY+1];
159 static char state[LEN_STATE+1], dphone[LEN_DPHONE+1], mphone[LEN_MPHONE+1];
160 static char sname[LEN_NAME+1], title[128];
161 static int nyear = 0;
162 int ends_jr, ends_iii, ends_iv, ends_sr, ends_ii, ends_v;
163 char *p;
164
165 if (nyear == 0) {
166 struct tm *tm;
167 struct timeval tv;
168
169 gettimeofday(&tv, NULL);
170 tm = localtime(&tv.tv_sec);
171 nyear = tm->tm_year;
172 if (tm->tm_mon > 5)
173 nyear++;
174 }
175
176 if (fgets(buf, sizeof(buf), in) == NULL)
177 return((struct entry *)NULL);
178
179 strncpy(name, &buf[LOC_NAME], LEN_NAME); name[LEN_NAME] = 0;
180 strncpy(id, &buf[LOC_ID], LEN_ID); id[LEN_ID] = 0;
181 strncpy(course, &buf[LOC_COURSE], LEN_COURSE); course[LEN_COURSE] = 0;
182 strncpy(year, &buf[LOC_YEAR], LEN_YEAR); year[LEN_YEAR] = 0;
183 strncpy(address, &buf[LOC_ADDRESS], LEN_ADDRESS); address[LEN_ADDRESS] = 0;
184 strncpy(dorm_room, &buf[LOC_DORM_ROOM], LEN_DORM_ROOM); dorm_room[LEN_DORM_ROOM] = 0;
185 strncpy(city, &buf[LOC_CITY], LEN_CITY); city[LEN_CITY] = 0;
186 strncpy(state, &buf[LOC_STATE], LEN_STATE); state[LEN_STATE] = 0;
187 strncpy(dphone, &buf[LOC_DPHONE], LEN_DPHONE); dphone[LEN_DPHONE] = 0;
188 strncpy(mphone, &buf[LOC_MPHONE], LEN_MPHONE); mphone[LEN_MPHONE] = 0;
189
190 strcpy(sname, name);
191 e.name = strtrim(sname);
192 p = index(name, ',');
193 if (p)
194 *p = 0;
195 e.last = strtrim(name);
196 if (p) {
197 p++;
198 while (isspace(*p))
199 p++;
200 e.first = p;
201 if (p = index(e.first, ' ')) {
202 *p = 0;
203 e.first = strtrim(e.first);
204 e.middle = strtrim(p + 1);
205 } else {
206 e.first = strtrim(e.first);
207 e.middle = "";
208 }
209 } else {
210 e.first = "";
211 e.middle = "";
212 }
213 ends_jr = ends_iii = ends_iv = ends_sr = ends_ii = ends_v = 0;
214 LookForSt(e.last);
215 LookForO(e.last);
216 LookForJrAndIII(e.last, &ends_sr, &ends_jr, &ends_iii, &ends_iv,
217 &ends_ii, &ends_v);
218 LookForJrAndIII(e.first, &ends_sr, &ends_jr, &ends_iii, &ends_iv,
219 &ends_ii, &ends_v);
220 FixCase(e.last);
221 FixCase(e.first);
222 FixCase(e.middle);
223
224 e.id = id;
225 e.id[LEN_ID] = 0;
226 e.eid = eid;
227 EncryptID(e.eid, e.id, e.first, e.last);
228
229 e.year = strtrim(year);
230 e.title = title;
231 if (e.year[0] == 'G') {
232 e.class = "G";
233 sprintf(title, "Grad Student");
234 } else {
235 e.class = classbuf;
236 sprintf(classbuf, "%d", nyear + 4 - atoi(e.year) + 1900);
237 sprintf(title, "Undergrad (class of %s)", classbuf);
238 }
239
240 e.course = strtrim(course);
241 e.address = strtrim(address);
242 e.dorm = strtrim(dorm_room);
243 e.city = strtrim(city);
244 e.state = strtrim(state);
245 e.dphone = strtrim(dphone);
246 e.mphone = strtrim(mphone);
247 return(&e);
248}
249
250
251process_entry(e)
252struct entry *e;
253{
254 int changed, nochange, encrypted;
255 char buf[BUFSIZ], *from, *to;
256 EXEC SQL BEGIN DECLARE SECTION;
257 char *first, *last, *middle, *eid, *title, *sid, *name, *rname, *rdept, *rtitle;
258 char *rophone, *rhphone, *prog;
259 char class[9], haddr[128], hphone[33], ophone[33], dept[33], raddr[128];
260 char dfirst[17], dlast[17], dmiddle[17];
261 int id, status, who;
262 EXEC SQL END DECLARE SECTION;
263
264 who = WHO;
265 prog = PROG;
266 first = e->first;
267 if (strlen(first) > 16)
268 first[16] = 0;
269 last = e->last;
270 if (strlen(last) > 16)
271 last[16] = 0;
272 middle = e->middle;
273 eid = e->eid;
274 sid = e->id;
275 id = 0;
276 encrypted = 0;
277
278 /* Get user info */
279 EXEC SQL REPEATED SELECT users_id, first, last, middle, type, home_addr, home_phone, office_phone, status, department
280 INTO :id, :dfirst, :dlast, :dmiddle, :class, :haddr, :hphone, :ophone, :status, :dept
281 FROM users
282 WHERE clearid = :sid;
283 if (sqlfail()) {
284 if (sqlca.sqlcode == SQL_DUPLICATE) {
285 com_err(whoami, 0, "duplicate ID number %s on user %s %s", sid, first, last);
286 return;
287 } else if (sqlca.sqlcode == SQL_DEADLOCK) {
288 com_err(whoami, MR_DEADLOCK, "looking up user %s", sid);
289 EXEC SQL ROLLBACK;
290 return process_entry(e);
291 } else
292 sqlexit();
293 }
294 if (id == 0) {
295 EXEC SQL REPEATED SELECT users_id, first, last, middle, type, home_addr, home_phone, office_phone, status, department
296 INTO :id, :dfirst, :dlast, :dmiddle, :class, :haddr, :hphone, :ophone, :status, :dept
297 FROM users
298 WHERE last = :last and first = :first and clearid = :eid;
299 if (sqlfail()) {
300 if (sqlca.sqlcode == SQL_DEADLOCK) {
301 com_err(whoami, MR_DEADLOCK, "looking up user %s", sid);
302 EXEC SQL ROLLBACK;
303 return process_entry(e);
304 } else if (sqlca.sqlcode != SQL_DUPLICATE)
305 sqlexit();
306 }
307 encrypted++;
308 if (id == 0) {
309 newuser(e);
310 return;
311 }
312 }
313
314 /* See if class changed: if it's different, and the value in the database
315 * is not STAFF or SIPB, then update the database. Since they were on the
316 * students tape, make the account usable.
317 */
318 if (strcmp(e->class, strtrim(class)) &&
319 strcmp(class, "STAFF") && strcmp(class, "SIPB")) {
320 com_err(whoami, 0, "updating class for user %s %s from %s to %s",
321 first, last, class, e->class);
322 if (status == US_NOT_ALLOWED) status = US_NO_LOGIN_YET;
323 if (status == US_ENROLL_NOT_ALLOWED) status = US_ENROLLED;
324 strcpy(class, e->class);
325 EXEC SQL REPEATED UPDATE users
326 SET type = :class, status = :status, modtime = 'now',
327 modby = :who, modwith = :prog
328 WHERE users_id = :id;
329 if (sqlca.sqlcode != 0) {
330 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
331 exit(1);
332 }
333 }
334
335 /* Update name if necessary */
336 if (strcmp(first, strtrim(dfirst)) ||
337 strcmp(last, strtrim(dlast)) ||
338 strcmp(middle, strtrim(dmiddle))) {
339 com_err(whoami, 0, "updating real name for %s %s", first, last);
340 EXEC SQL UPDATE users
341 SET first = :first, last = :last, middle = :middle,
342 modby = :who, modwith = :prog, modtime = 'now'
343 WHERE users_id = :id;
344 if (sqlca.sqlcode != 0) {
345 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
346 exit(1);
347 }
348 }
349
350 /* Deal with updating the finger info if necessary */
351 changed = nochange = 0;
352 if (encrypted) changed++;
353 strcpy(buf, e->address);
354 if (*e->dorm) {
355 strcat(buf, " ");
356 strcat(buf, e->dorm);
357 }
358 if (*e->city) {
359 strcat(buf, " ");
360 strcat(buf, e->city);
361 }
362 FixCase(buf);
363 if (*e->state) {
364 strcat(buf, " ");
365 strcat(buf, e->state);
366 }
367 while (to = index(buf, ','))
368 *to = ';';
369 while (to = index(buf, ':'))
370 *to = ';';
371 if (newfinger) {
372 if (haddr[0] == ' ') {
373 strncpy(haddr, buf, 80);
374 haddr[80] = 0;
375 changed++;
376 } else if (strncmp(strtrim(haddr), buf, 80))
377 nochange++;
378 } else {
379 if (strncmp(strtrim(haddr), buf, 80))
380 changed++;
381 strncpy(haddr, buf, 80);
382 haddr[80] = 0;
383 }
384 from = e->dphone;
385 to = buf;
386 while (*from) {
387 if (isdigit(*from))
388 *to++ = *from;
389 from++;
390 }
391 *to = 0;
392 if (newfinger) {
393 if (hphone[0] == ' ') {
394 strncpy(hphone, buf, 16);
395 hphone[16] = 0;
396 } else if (strncmp(strtrim(hphone), buf, 16))
397 nochange++;
398 } else {
399 if (strncmp(strtrim(hphone), buf, 16))
400 changed++;
401 strncpy(hphone, buf, 16);
402 hphone[16] = 0;
403 }
404 from = e->mphone;
405 to = buf;
406 while (*from) {
407 if (isdigit(*from))
408 *to++ = *from;
409 from++;
410 }
411 *to = 0;
412 if (newfinger) {
413 if (ophone[0] == ' ') {
414 strncpy(ophone, buf, 12);
415 ophone[12] = 0;
416 } else if (strncmp(strtrim(ophone), buf, 12))
417 nochange++;
418 } else {
419 if (strncmp(strtrim(ophone), buf, 12))
420 changed++;
421 strncpy(ophone, buf, 12);
422 ophone[12] = 0;
423 }
424 e->course = e->course;
425 if (newfinger) {
426 if (dept[0] == ' ') {
427 strncpy(dept, e->course, 12);
428 dept[12] = 0;
429 } else if (strncmp(strtrim(dept), e->course, 11))
430 nochange++;
431 } else {
432 if (strncmp(strtrim(dept), e->course, 11))
433 changed++;
434 strncpy(dept, e->course, 12);
435 dept[12] = 0;
436 }
437 sid = e->id;
438 name = e->name;
439 rdept = e->course;
440 rtitle = e->title;
441 rophone = e->mphone;
442 rhphone = e->dphone;
443 strcpy(raddr, e->address);
444 if (*e->dorm) {
445 strcat(raddr, " ");
446 strcat(raddr, e->dorm);
447 }
448 strcat(raddr, "|");
449 if (*e->city) {
450 strcat(raddr, e->city);
451 FixCase(raddr);
452 if (*e->state) {
453 strcat(raddr, " ");
454 if (isupper(e->state[0]) && isupper(e->state[1]) &&
455 isdigit(e->state[2]) && isdigit(e->state[3]) &&
456 isdigit(e->state[4]) && isdigit(e->state[5]) &&
457 isdigit(e->state[6])) {
458 sprintf(buf, "%c%c %s", e->state[0],e->state[1],
459 &(e->state[2]));
460 strcat(raddr, buf);
461 } else
462 strcat(raddr, e->state);
463 }
464 } else {
465 FixCase(raddr);
466 strcat(raddr, "MIT INTERDEPARTMENTAL MAIL");
467 }
468 if (changed) {
469 com_err(whoami, 0, "updating finger for %s %s", first, last);
470 EXEC SQL REPEATED UPDATE users
471 SET home_addr = :haddr, home_phone = :hphone,
472 office_phone = :ophone, department = :dept,
473 fmodtime = 'now', fmodby = :who, fmodwith = :prog,
474 xname = :name, xdept = :rdept, xtitle = :rtitle,
475 xaddress = :raddr, xphone1 = :rhphone, xphone2 = :rophone,
476 xmodtime = date('now'), clearid = :sid
477 WHERE users_id = :id;
478 if (sqlca.sqlcode != 0) {
479 if (sqlca.sqlcode == SQL_DEADLOCK) {
480 com_err(whoami, MR_DEADLOCK, "updating user %s", sid);
481 EXEC SQL ROLLBACK;
482 return process_entry(e);
483 } else {
484 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
485 exit(1);
486 }
487 }
488 } else {
489 EXEC SQL REPEATED UPDATE users
490 SET xname = :name, xdept = :rdept, xtitle = :rtitle,
491 xaddress = :raddr, xphone1 = :rhphone, xphone2 = :rophone,
492 xmodtime = date('now'), clearid = :sid
493 WHERE users_id = :id;
494 if (sqlca.sqlcode != 0) {
495 if (sqlca.sqlcode == SQL_DEADLOCK) {
496 com_err(whoami, MR_DEADLOCK, "updating user %s", sid);
497 EXEC SQL ROLLBACK;
498 return process_entry(e);
499 } else {
500 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
501 exit(1);
502 }
503 }
504 }
505}
506
507
508newuser(e)
509struct entry *e;
510{
511 char buf[512], *from, *to;
512 EXEC SQL BEGIN DECLARE SECTION;
513 int id, uid, who;
514 char *last, *first, *class, *middle, login[9], *sid, fullname[65], *prog;
515 char haddr[81], hphone[17], ophone[13], dept[24], *title, raddr[81], *name;
516 EXEC SQL END DECLARE SECTION;
517
518 who = WHO;
519 prog = PROG;
520 strcpy(buf, e->address);
521 if (*e->dorm) {
522 strcat(buf, " ");
523 strcat(buf, e->dorm);
524 }
525 if (*e->city) {
526 strcat(buf, " ");
527 strcat(buf, e->city);
528 }
529 if (*e->state) {
530 strcat(buf, " ");
531 strcat(buf, e->state);
532 }
533 strncpy(haddr, buf, 80);
534 from = e->dphone;
535 to = buf;
536 while (*from) {
537 if (isdigit(*from))
538 *to++ = *from;
539 from++;
540 }
541 *to = 0;
542 strncpy(hphone, buf, 16);
543 from = e->mphone;
544 to = buf;
545 while (*from) {
546 if (isdigit(*from))
547 *to++ = *from;
548 from++;
549 }
550 *to = 0;
551 strncpy(ophone, buf, 12);
552 strncpy(dept, e->course, 12);
553
554 id = set_next_users_id(0);
555 uid = set_next_uid(1);
556 sprintf(login, "#%d", uid);
557 last = e->last;
558 first = e->first;
559 middle = e->middle;
560 sid = e->id;
561 class = e->class;
562 title = e->title;
563 if (*middle)
564 sprintf(fullname, "%s %s %s", first, middle, last);
565 else
566 sprintf(fullname, "%s %s", first, last);
567 name = e->name;
568 strcpy(raddr, e->address);
569 if (*e->dorm) {
570 strcat(raddr, " ");
571 strcat(raddr, e->dorm);
572 }
573 strcat(raddr, "|");
574 if (*e->city) {
575 strcat(raddr, e->city);
576 FixCase(raddr);
577 if (*e->state) {
578 strcat(raddr, " ");
579 if (isupper(e->state[0]) && isupper(e->state[1]) &&
580 isdigit(e->state[2]) && isdigit(e->state[3]) &&
581 isdigit(e->state[4]) && isdigit(e->state[5]) &&
582 isdigit(e->state[6])) {
583 sprintf(buf, "%c%c %s", e->state[0],e->state[1],
584 &(e->state[2]));
585 strcat(raddr, buf);
586 } else
587 strcat(raddr, e->state);
588 }
589 } else {
590 FixCase(raddr);
591 strcat(raddr, "MIT INTERDEPARTMENTAL MAIL");
592 }
593 EXEC SQL REPEATED INSERT INTO users
594 (login, users_id, uid, shell, last, first, middle, status,
595 clearid, type, modtime, modby, modwith, fullname, home_addr,
596 home_phone, office_phone, department, fmodtime, fmodby, fmodwith,
597 potype, xname, xdept, xtitle, xaddress, xphone1, xphone2, xmodtime)
598 VALUES (:login, :id, :uid, '/bin/csh', :last, :first, :middle, 0,
599 :sid, :class, 'now', :who, :prog, :fullname, :haddr, :hphone,
600 :ophone, :dept, 'now', :who, :prog, 'NONE', :name, :dept,
601 :title, :raddr, :hphone, :ophone, date('now'));
602 if (sqlca.sqlcode != 0) {
603 if (sqlca.sqlcode == SQL_DEADLOCK) {
604 com_err(whoami, MR_DEADLOCK, "adding user %s", sid);
605 EXEC SQL ROLLBACK;
606 return newuser(e);
607 } else {
608 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
609 exit(1);
610 }
611 } else
612 com_err(whoami, 0, "adding user %s %s", e->first, e->last);
613}
614
615
616
617set_next_users_id(limit)
618 int limit;
619{
620 EXEC SQL BEGIN DECLARE SECTION;
621 int rowcount, flag, value, retval;
622 EXEC SQL END DECLARE SECTION;
623
624 EXEC SQL REPEATED SELECT value INTO :value FROM numvalues
625 WHERE name = 'users_id';
626 if (sqlfail()) sqlexit();
627 if (sqlca.sqlerrd[2] != 1) {
628 EXEC SQL ROLLBACK;
629 com_err(whoami, MR_INTERNAL, "values table inconsistancy");
630 exit(1);
631 }
632
633 flag = 0;
634 EXEC SQL REPEATED SELECT users_id INTO :flag FROM users
635 WHERE users_id = :value;
636 if (sqlfail()) sqlexit();
637 if (sqlca.sqlerrd[2] == 0)
638 flag = 0;
639 while (flag) {
640 value++;
641 if (limit && value > MAX_ID_VALUE)
642 value = MIN_ID_VALUE;
643 flag = 0;
644 EXEC SQL REPEATED SELECT users_id INTO :flag FROM users
645 WHERE users_id = :value;
646 if (sqlfail()) sqlexit();
647 if (sqlca.sqlerrd[2] == 0)
648 flag = 0;
649 }
650
651 retval = value++;
652 if (limit && value > MAX_ID_VALUE)
653 value = MIN_ID_VALUE;
654 EXEC SQL REPEATED UPDATE numvalues SET value = :value
655 WHERE name = 'users_id';
656 if (sqlca.sqlcode != 0) {
657 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
658 exit(1);
659 }
660 return(retval);
661}
662
663set_next_uid(limit)
664 int limit;
665{
666 EXEC SQL BEGIN DECLARE SECTION;
667 int rowcount, flag, value, retval;
668 EXEC SQL END DECLARE SECTION;
669
670 EXEC SQL REPEATED SELECT value INTO :value FROM numvalues
671 WHERE name = 'uid';
672 if (sqlfail()) sqlexit();
673 if (sqlca.sqlerrd[2] != 1) {
674 EXEC SQL ROLLBACK;
675 com_err(whoami, MR_INTERNAL, "values table inconsistancy");
676 exit(1);
677 }
678
679 flag = 0;
680 EXEC SQL REPEATED SELECT uid INTO :flag FROM users WHERE uid = :value;
681 if (sqlfail()) sqlexit();
682 if (sqlca.sqlerrd[2] == 0)
683 flag = 0;
684 while (flag) {
685 value++;
686 if (limit && value > MAX_ID_VALUE)
687 value = MIN_ID_VALUE;
688 flag = 0;
689 EXEC SQL REPEATED SELECT uid INTO :flag FROM users WHERE uid = :value;
690 if (sqlfail()) sqlexit();
691 if (sqlca.sqlerrd[2] == 0)
692 flag = 0;
693 }
694
695 retval = value++;
696 if (limit && value > MAX_ID_VALUE)
697 value = MIN_ID_VALUE;
698 EXEC SQL REPEATED UPDATE numvalues SET value = :value WHERE name = 'uid';
699 if (sqlca.sqlcode != 0) {
700 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
701 exit(1);
702 }
703 return(retval);
704}
705
706
707sqlexit()
708{
709 if (sqlca.sqlcode == SQL_DEADLOCK)
710 com_err(whoami, MR_DEADLOCK, "unrecoverable ingres error %d",
711 sqlca.sqlcode);
712 else
713 com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
714 EXEC SQL ROLLBACK WORK;
715 exit(1);
716}
This page took 0.039311 seconds and 5 git commands to generate.