]> andersk Git - moira.git/blobdiff - dbck/phase1.dc
check new hosttable info
[moira.git] / dbck / phase1.dc
index 60256c0b1d85a7ead7d6a892768a8b5f77615e0b..a937cebe9b474d319b34a15279dc4badfefe6db7 100644 (file)
@@ -306,11 +306,14 @@ phase1()
     sq = sq_create();
 
     EXEC SQL DECLARE csr104 CURSOR FOR
-       SELECT mach_id, name, modby FROM machine ORDER BY mach_id;
+       SELECT mach_id, name, snet_id, owner_type, owner_id,
+               acomment, ocomment, creator, modby
+       FROM machine ORDER BY mach_id;
     if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr104;
     while(1) {
-       EXEC SQL FETCH csr104 INTO :id, :name, :sid;
+       EXEC SQL FETCH csr104 INTO :id, :name, :id2, :buf, :id3, :sid2,
+               :sid3, :sid4, :sid;
        if (sqlca.sqlcode != 0) {
          ingerr(&sqlca.sqlcode);
          break;
@@ -320,14 +323,19 @@ phase1()
        if (m == NULL)
          out_of_mem("storing machines");
        strcpy(m->name, strtrim(name));
+       m->owner_type = buf[0];
+       m->owner_id = id3;
+       m->snet_id = id2;
        m->mach_id = id;
        m->clucount = 0;
        if (hash_store(machines, id, m)) {
            sq_save_data(sq, hash_lookup(machines, id));
            sq_save_data(sq, m);
        }
-       if (sid < 0)
-         string_check(-sid);
+       if (sid2) string_check(sid2);
+       if (sid3) string_check(sid3);
+       if (sid4 < 0) string_check(-sid4);
+       if (sid < 0) string_check(-sid);
     }
     EXEC SQL CLOSE csr104; 
     generic_fix(sq, show_mach_id, "Change ID", fix_mach_id, 0);
@@ -353,6 +361,25 @@ phase1()
        generic_fix(sq, show_mach_name, "Change name", cant_fix, 0);
     }  
 
+    dprintf("Loading subnets...\n");
+    subnets = create_hash(254);
+
+    EXEC SQL DECLARE csr115 CURSOR FOR
+      SELECT snet_id, name from subnet;
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
+    EXEC SQL OPEN csr115;
+    while(1) {
+       EXEC SQL FETCH csr115 INTO :id, :name;
+       if (sqlca.sqlcode != 0) {
+         ingerr(&sqlca.sqlcode);
+         break;
+       } 
+       if (hash_store(subnets, id, name)) {
+           printf("Duplicate subnet ID: %d (%s)\n", id, name);
+       }
+    }
+    EXEC SQL CLOSE csr115;
+
     dprintf("Loading clusters...\n");
     sq = sq_create();
     clusters = create_hash(100);
This page took 0.033667 seconds and 4 git commands to generate.