Update of /cvsroot/monetdb/clients/src/mapiclient
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30327

Modified Files:
        MapiClient.mx 
Log Message:
Trace rendering is cleaner now. The performance indicators are visualized
in their own column. All non-mal return is rendered 'raw' (with tabs
cast to a single space).


Index: MapiClient.mx
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/MapiClient.mx,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- MapiClient.mx       16 Aug 2007 08:17:38 -0000      1.53
+++ MapiClient.mx       16 Aug 2007 14:24:50 -0000      1.54
@@ -521,41 +521,56 @@
 SQLtraceRenderer(MapiHdl hdl)
 {
        int ps = rowsperpage, rows = 0, silent = 0;
-       char *fields[1];
+       char *fields[2];
        char *s;
-       int len[1];
-       int kind = 1;
-       int numeric[1];
+       int len[2];
+       int cols = 1;
+       int numeric[2];
 
        if (mapi_result_error(hdl) != NULL) {
                mapi_explain_result(hdl, stderr);
        }
        len[0] = pagewidth-4; /* remove borders */
        numeric[0] = 0;
+       numeric[1] = 0;
 
-       SQLseparator(len, 1, '-');
        while ((fields[0] = mapi_fetch_line(hdl)) != NULL) {
                if (silent)
                        continue;
-               if (strstr(fields[0], "usec ")) {
-                       if (kind == 0)
-                               SQLseparator(len, 1, '+');
-                       kind = 1;
-               } else {
-                       if (kind == 1)
-                               SQLseparator(len, 1, '+');
-                       kind = 0;
-               }
+               if( *fields[0]=='%' && pagewidth>=0)
+                       continue;
+
                /* simple render */
                fields[0] = fields[0] + 1;
                s = strrchr(fields[0], ']');
                if (s)
                        *s = 0;
-               SQLrow(len, numeric, fields, 1,0);
-               if (ps && rows % ps == ps - 1 && rows != 
mapi_get_row_count(hdl) && fromConsole) {
+
+               if ( (s=strstr(fields[0], "usec  #")) ){
+                       s= strchr(s,'#');
+                       *s=0;
+                       fields[1]=s+1;
+                       if (cols == 1){
+                               len[1]= len[0]-strlen(fields[0]);
+                               len[0]= strlen(fields[0])-2; /* border */
+                               SQLseparator(len, 2, '-');
+                               cols = 2;
+                       }
+               } else {
+                       int olen[1];
+                       char *t;
+                       olen[0]= pagewidth-4;
+                       for( t= fields[0]; *t; t++)
+                               if( *t == '\t') *t =' ';
+                       SQLrow(olen, numeric, fields, 1,0);
+                       continue; /* output should be rendered differently */ 
+               }
+               SQLrow(len, numeric, fields, cols,0);
+               if (ps && rows % ps == ps - 1 && 
+                       rows != mapi_get_row_count(hdl) && fromConsole) {
                        char buf[BUFSIZ];
 
-                       SQLseparator(len, 1, '-');
+                       SQLseparator(len, cols, '-');
                        fprintf(toConsole, "next page? (continue,quit,next)");
                        fgets(buf, BUFSIZ, fromConsole);
                        if (buf[0] == 'c')
@@ -563,11 +578,11 @@
                        if (buf[0] == 'q')
                                silent = 1;
                        if (silent == 0)
-                               SQLseparator(len, 1, '-');
+                               SQLseparator(len, cols, '-');
                }
                rows++;
        }
-       SQLseparator(len, 1, '-');
+       SQLseparator(len, cols, '-');
 }
 
 static void


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to