]> andersk Git - moira.git/blobdiff - gen/stats.dc
cleaned up SQL port
[moira.git] / gen / stats.dc
index 4e8dd9a58665bc07bbc7ca06748b083d0a13faa5..feea0f57ccc90de52078bc37aaaba9587eb21eb6 100644 (file)
@@ -37,10 +37,11 @@ char **argv;
     EXEC SQL END DECLARE SECTION;
 
 #ifsql INGRES
-    EXEC SQL CONNECT sms;
+    EXEC SQL CONNECT moira;
+    EXEC SQL SET LOCKMODE SESSION WHERE LEVEL=TABLE, READLOCK=SHARED;
 #endsql
 #ifsql INFORMIX
-    EXEC SQL DATABASE sms;
+    EXEC SQL DATABASE moira;
 #endsql
 
     if (argc == 2) {
@@ -67,6 +68,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,13 +90,13 @@ 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) {
        EXEC SQL FETCH x INTO :id, :n;
        if (sqlca.sqlcode != 0) break;
-       fprintf(out, "%s %d\n", hash_lookup(machines, id), n);
+       fprintf(out, "%-32s %d\n", hash_lookup(machines, id), n);
     }
     EXEC SQL CLOSE x;
 
This page took 0.034432 seconds and 4 git commands to generate.