]> andersk Git - moira.git/blobdiff - dbck/fix.qc
moved generic_fix; keep track of modified tables; missing newline on
[moira.git] / dbck / fix.qc
index 6637a662fa32a13e4a5927202daa8a2cd1256e42..643ee37fd5111c8120e9936f0c9271655cd53838 100644 (file)
@@ -12,6 +12,8 @@
 #include <stdio.h>
 #include "dbck.h"
 
+static char fix_qc_rcsid[] = "$Header$";
+
 
 ##char *_table;
 ##char *_idfield;
@@ -27,6 +29,7 @@
       printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
     else
       printf("Not deleted\n");
+    modified(_table);
 ##}
 
 
@@ -64,25 +67,10 @@ int id;
       printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
     else
       printf("Not fixed\n");
+    modified(table);
 ##}
 
 
-generic_fix(sq, pfunc, msg, ffunc, preen)
-struct save_queue *sq;
-char *msg;
-int (*pfunc)(), (*ffunc)();
-int preen;
-{
-    int id;
-
-    while (sq_get_data(sq, &id)) {
-       if ((*pfunc)(id) == 0 && singe_fix(msg, preen))
-         (*ffunc)(id);
-    }
-    sq_destroy(sq);
-}
-
-
 int single_fix(msg, preen)
 char *msg;
 int preen;
@@ -111,6 +99,22 @@ int preen;
 }
 
 
+generic_fix(sq, pfunc, msg, ffunc, preen)
+struct save_queue *sq;
+char *msg;
+int (*pfunc)(), (*ffunc)();
+int preen;
+{
+    int id;
+
+    while (sq_get_data(sq, &id)) {
+       if ((*pfunc)(id) == 0 && single_fix(msg, preen))
+         (*ffunc)(id);
+    }
+    sq_destroy(sq);
+}
+
+
 int prompt(msg)
 char *msg;
 {
@@ -129,12 +133,14 @@ char *msg;
            if (prompt("Are you sure you want to quit")) {
                if (prompt("Save database changes")) {
 ##                 end transaction
-##                 replace values (value = dcmenable)
-##                     where values.name = "dcm_enable"
-##                 exit
+                   cleanup();
                    exit(0);
                } else {
-                   cleanup();
+##                 abort
+##                 replace values (value = dcmenable)
+##                     where values.name = "dcm_enable"
+##                 exit
+                   exit(1);
                }
            }
        }
@@ -179,8 +185,9 @@ int set_next_object_id(object, table)
 ##     retrieve (exists = any(tbl.name where tbl.name = value))
     }
 
-    printf("setting ID %s to %d", name, value);
+    printf("setting ID %s to %d\n", name, value);
 ##  repeat replace v (#value = @value) where v.#name = @name
+    modified("values");
     return(SMS_SUCCESS);
 ##}
 
@@ -203,5 +210,6 @@ int set_next_object_id(object, table)
       printf("Fixed\n");
     else
       printf("Not fixed, rowcount = %d\n", rowcount);
+    modified(table);
     return(id);
 ##}
This page took 0.052483 seconds and 4 git commands to generate.