From 9fd1c2b83bdc96f1c815f095e6e4d80cb33e7ee5 Mon Sep 17 00:00:00 2001 From: genoa Date: Mon, 14 Sep 1992 23:21:53 +0000 Subject: [PATCH] New database and column names for Moira2. --- gen/ca.dc | 9 ++++++--- gen/letter.dc | 4 ++-- gen/mailhub.dc | 9 ++++++--- gen/mitdir.dc | 10 +++++++--- gen/nfs.dc | 10 +++++++--- gen/passwd.dc | 8 ++++++-- gen/pobox.dc | 16 ++++++++++------ gen/prlogger.dc | 10 +++++++--- gen/sis.dc | 10 +++++++--- gen/stats.dc | 10 +++++++--- gen/zephyr.dc | 12 ++++++++---- 11 files changed, 73 insertions(+), 35 deletions(-) diff --git a/gen/ca.dc b/gen/ca.dc index d452559a..9a93eb47 100644 --- a/gen/ca.dc +++ b/gen/ca.dc @@ -46,10 +46,10 @@ char **argv; initialize_sms_error_table (); #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -75,6 +75,9 @@ char **argv; outf = NULL; } + /* The following WHENEVER is declarative, not executed, + * and applies for the remainder of this file only. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; sq = sq_create(); @@ -126,7 +129,7 @@ char **argv; EXEC SQL DECLARE z CURSOR FOR SELECT DISTINCT u.login, u.fullname, f.name FROM users u, filesys f - WHERE f.label = u.login and u.status = 1 and f.type = "AFS" + WHERE f.label = u.login and u.status = 1 and f.type = 'AFS' ORDER BY name; EXEC SQL OPEN z; while (1) { diff --git a/gen/letter.dc b/gen/letter.dc index adb9044c..8ff25757 100644 --- a/gen/letter.dc +++ b/gen/letter.dc @@ -40,10 +40,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { diff --git a/gen/mailhub.dc b/gen/mailhub.dc index 9d3c9719..42a4dbe9 100644 --- a/gen/mailhub.dc +++ b/gen/mailhub.dc @@ -1,4 +1,3 @@ - /* $Header$ * * This generates the /usr/lib/aliases file for the mailhub. @@ -47,10 +46,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -145,6 +144,10 @@ get_info() struct list *l, *memberlist; register struct member *m; + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL SELECT modtime INTO :buf FROM users WHERE users_id = 0; diff --git a/gen/mitdir.dc b/gen/mitdir.dc index 666264e0..6db511d7 100644 --- a/gen/mitdir.dc +++ b/gen/mitdir.dc @@ -40,10 +40,10 @@ char **argv; initialize_sms_error_table(); #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -100,6 +100,10 @@ FILE *out; char affil[5]; EXEC SQL END DECLARE SECTION; + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; /* get locks */ @@ -119,7 +123,7 @@ FILE *out; EXEC SQL DECLARE u_cursor1 CURSOR FOR SELECT users_id, login, first, middle, last, - mit_year, mit_dept, office_addr, office_phone, + affiliation, department, office_addr, office_phone, home_addr, home_phone, potype, box_id FROM users WHERE status != 3; diff --git a/gen/nfs.dc b/gen/nfs.dc index d8b68a8e..fb2c915b 100644 --- a/gen/nfs.dc +++ b/gen/nfs.dc @@ -40,10 +40,10 @@ char **argv; sprintf(nfs_dir, "%s/nfs", DCM_DIR); #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql changed = do_nfs(); @@ -85,6 +85,10 @@ int do_nfs() machs = sq_create(); lists = sq_create(); + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE s_cursor CURSOR FOR SELECT m.name, s.value3 @@ -231,7 +235,7 @@ struct hash *do_everyone() EXEC SQL DECLARE l_cursor CURSOR FOR SELECT gid, list_id FROM list - WHERE grp <> 0 AND active != 0; + WHERE grouplist != 0 AND active != 0; EXEC SQL OPEN l_cursor; while (1) { EXEC SQL FETCH l_cursor INTO :gid, :lid; diff --git a/gen/passwd.dc b/gen/passwd.dc index 658163ab..ea66e640 100644 --- a/gen/passwd.dc +++ b/gen/passwd.dc @@ -35,10 +35,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -64,6 +64,10 @@ char **argv; outf = NULL; } + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE x CURSOR FOR SELECT diff --git a/gen/pobox.dc b/gen/pobox.dc index 0c1d3296..d35beb02 100644 --- a/gen/pobox.dc +++ b/gen/pobox.dc @@ -33,10 +33,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -62,11 +62,15 @@ char **argv; outf = NULL; } + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE x CURSOR FOR SELECT - mit_id, login - FROM users WHERE status != 3 and potype="POP"; + clearid, login + FROM users WHERE status != 3 and potype='POP'; EXEC SQL OPEN x; while (1) { EXEC SQL FETCH x INTO :id, :login; @@ -80,9 +84,9 @@ char **argv; EXEC SQL CLOSE x; EXEC SQL DECLARE y CURSOR FOR SELECT - u.mit_id, s.string + u.clearid, s.string FROM users u, strings s - WHERE u.status != 3 and u.potype="SMTP" and u.box_id = s.string_id; + WHERE u.status != 3 and u.potype='SMTP' and u.box_id = s.string_id; EXEC SQL OPEN y; while (1) { EXEC SQL FETCH y INTO :id, :string; diff --git a/gen/prlogger.dc b/gen/prlogger.dc index 354c7299..6d8012c6 100644 --- a/gen/prlogger.dc +++ b/gen/prlogger.dc @@ -33,10 +33,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -62,10 +62,14 @@ char **argv; outf = NULL; } + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE x CURSOR FOR - SELECT login, mit_year FROM users WHERE status = 1; + SELECT login, affiliation FROM users WHERE status = 1; EXEC SQL OPEN x; while (1) { EXEC SQL FETCH x INTO :login, :class; diff --git a/gen/sis.dc b/gen/sis.dc index 284b2c7f..06192c78 100644 --- a/gen/sis.dc +++ b/gen/sis.dc @@ -49,10 +49,10 @@ char **argv; initialize_sms_error_table (); #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -81,10 +81,14 @@ char **argv; gettimeofday(&now, NULL); cutoff = now.tv_sec - 14 * 24 * 60 * 60; + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE x CURSOR FOR - SELECT u.login, u.mit_id, u.signature, u.sigdate, s.string + SELECT u.login, u.clearid, u.signature, u.sigdate, s.string FROM users u, strings s WHERE u.status = 1 and u.sigwho = s.string_id and u.sigwho != 0 and u.secure <= :cutoff and u.secure != 0; diff --git a/gen/stats.dc b/gen/stats.dc index 4e8dd9a5..78d6de9e 100644 --- a/gen/stats.dc +++ b/gen/stats.dc @@ -37,10 +37,10 @@ char **argv; EXEC SQL END DECLARE SECTION; #ifsql INGRES - EXEC SQL CONNECT sms; + EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX - EXEC SQL DATABASE sms; + EXEC SQL DATABASE moira; #endsql if (argc == 2) { @@ -67,6 +67,10 @@ char **argv; outf = NULL; } + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; machines = create_hash(1000); @@ -85,7 +89,7 @@ char **argv; EXEC SQL DECLARE x CURSOR FOR SELECT DISTINCT f.mach_id, count(f.filsys_id) FROM filesys f - WHERE f.type="NFS" + WHERE f.type='NFS' GROUP BY f.mach_id; EXEC SQL OPEN x; while (1) { diff --git a/gen/zephyr.dc b/gen/zephyr.dc index fc4a2f68..9bb1fe8f 100644 --- a/gen/zephyr.dc +++ b/gen/zephyr.dc @@ -38,10 +38,10 @@ char **argv; sprintf(zephyr_dir, "%s/zephyr", DCM_DIR); #ifsql INGRES -EXEC SQL CONNECT sms; +EXEC SQL CONNECT moira; #endsql #ifsql INFORMIX -EXEC SQL DATABASE sms; +EXEC SQL DATABASE moira; #endsql changed = do_classes(); @@ -116,6 +116,10 @@ int do_classes() top = (struct zclass *)malloc(sizeof(struct zclass)); next = top; + /* The following is declarative, not executed, + * and so is dependent on where it is in the file, + * not in the order of execution of statements. + */ EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE classes CURSOR FOR SELECT class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id @@ -218,7 +222,7 @@ char *atype; EXEC SQL DECLARE umember CURSOR FOR SELECT users.login FROM users, imembers - WHERE imembers.list_id = :zid and imembers.member_type="USER" and + WHERE imembers.list_id = :zid and imembers.member_type='USER' and imembers.member_id=users.users_id; EXEC SQL OPEN umember; while (1) { @@ -235,7 +239,7 @@ char *atype; EXEC SQL DECLARE smember CURSOR FOR SELECT strings.string FROM strings, imembers WHERE imembers.list_id = :zid and imembers.member_id=strings.string_id - and (imembers.member_type="STRING" or imembers.member_type="KERBEROS"); + and (imembers.member_type='STRING' or imembers.member_type='KERBEROS'); EXEC SQL OPEN smember; while (1) { EXEC SQL FETCH smember INTO :str; -- 2.45.2