BUILDTOP=..
mrbindir=@mrbindir@
-OBJS=dbck.o fix.o phase1.o phase2.o phase3.o phase4.o
+DBCK_OBJS=dbck.o fix.o phase1.o phase2.o phase3.o phase4.o
+MEMBERS_OBJS=members.o
+OBJS= $(DBCK_OBJS) $(MEMBERS_OBJS)
-CFILES=dbck.c fix.c phase1.c phase2.c phase3.c phase4.c
+CFILES=dbck.c fix.c phase1.c phase2.c phase3.c phase4.c members.c
-TARGET=dbck
+TARGET=dbck members
.SUFFIXES: .pc
install:
$(INSTALL_PROGRAM) dbck $(mrbindir)
+ $(INSTALL_PROGRAM) members $(mrbindir)
+
+dbck: $(DBCK_OBJS) $(MR_LIBDEP)
+ $(CC) -o $@ $(LDFLAGS) $(DBCK_OBJS) $(LIBS)
+
+members: members.o $(MR_LIBDEP)
+ $(CC) -o $@ $(LDFLAGS) members.o $(LIBS)
+
+
+
+
-$(TARGET): $(OBJS) $(MR_LIBDEP)
- $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
void fix_member(), display_member();
int debug = 0, records = 0;
+char *db = "moira/moira";
main(argc, argv)
int argc;
#endif DEBUG
/* ingres sms */
- EXEC SQL CONNECT moira;
+ EXEC SQL CONNECT :db;
/* begin transaction */
/* range of m is imembers */
/* No equivalent */
* and m.member_type = mtype */
EXEC SQL DELETE FROM imembers WHERE list_id = :list_id AND
member_id = :member_id AND member_type = :mtype;
- EXEC SQL INQUIRE_SQL(:rowcount = rowcount);
- printf(" %d rows deleted\n", rowcount);
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s deleted\n", rowcount,
+ rowcount == 1 ? "y" : "ies");
#endif FIXERRORS
}
if (errmis > 0)
EXEC SQL INSERT INTO imembers (list_id, member_id,
member_type, ref_count, direct)
VALUES (:list_id, :member_id, :mtype, :ref_count, :dflag);
- EXEC SQL INQUIRE_SQL(:rowcount = rowcount);
- printf(" %d rows added\n", rowcount);
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s added\n", rowcount,
+ rowcount == 1 ? "y" : "ies");
#endif FIXERRORS
continue;
}
SET ref_count=ref_count+:ref_count, direct = :dflag
WHERE list_id = :list_id AND member_id = :member_id AND
member_tpe = :mtype;
- EXEC SQL INQUIRE_SQL(:rowcount = rowcount);
- printf(" %d rows fixed\n", rowcount);
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s updated\n", rowcount,
+ rowcount == 1 ? "y" : "ies");
#endif FIXERRORS
}
}