]> andersk Git - moira.git/blobdiff - dbck/phase4.dc
check for error after setting up each cursor
[moira.git] / dbck / phase4.dc
index 66c4a085e24806f96a837a52e5ef8894568ccb7e..f90586556408c6e024c9e634281f8efe1d8ba4c3 100644 (file)
@@ -106,6 +106,7 @@ phase4()
     EXEC SQL DECLARE csr401 CURSOR FOR
        SELECT mach_id, value1 FROM serverhosts
            WHERE service='POP';
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr401;
     while(1) {
        EXEC SQL FETCH csr401 INTO :id, :cnt;
@@ -143,6 +144,7 @@ count_only_setup()
        SELECT users_id, login, last, first, status, 
               potype, pop_id, box_id FROM users
            WHERE potype='POP';
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr402;
     while(1) {
        EXEC SQL FETCH csr402 INTO :id, :name, :last, :first, :status, 
@@ -179,6 +181,7 @@ count_only_setup()
     machines = create_hash(1000);
     EXEC SQL DECLARE csr403 CURSOR FOR
        SELECT mach_id, name FROM machine;
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr403;
     while(1) {
        EXEC SQL FETCH csr403 INTO :id, :name;
@@ -200,6 +203,7 @@ count_only_setup()
     nfsphys = create_hash(500);
     EXEC SQL DECLARE csr404 CURSOR FOR
        SELECT nfsphys_id, dir, mach_id, allocated FROM nfsphys;
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr404;
     while(1) {
        EXEC SQL FETCH csr404 INTO :id, :name, :id2, :id3;
@@ -223,6 +227,7 @@ count_only_setup()
     dprintf("Counting quotas...\n");
     EXEC SQL DECLARE csr405 CURSOR FOR
        SELECT phys_id, quota FROM quota;
+    if (sqlca.sqlcode != 0) ingerr(&sqlca.sqlcode);
     EXEC SQL OPEN csr405;
     while(1) {
        EXEC SQL FETCH csr405 INTO :id, :id2;
This page took 0.0337 seconds and 4 git commands to generate.