Update of /cvsroot/monetdb/sql/src/backends/monet4
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7368/src/backends/monet4

Modified Files:
        sql_server.mx sql_session.mx 
Log Message:
adding special output for algebra version

changed sql.trace() into sql.logfile(filename:string), which can be called
from sql too.
fixed handling of dependency problem on views (one remains)



Index: sql_session.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet4/sql_session.mx,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -d -r1.238 -r1.239
--- sql_session.mx      27 Jan 2008 15:09:24 -0000      1.238
+++ sql_session.mx      28 Jan 2008 16:25:52 -0000      1.239
@@ -66,16 +66,8 @@
 #include <sql_storage.h>
 #include <mapi/mapi.h>
 
-static int keep_trace = 0;
 static char *sqlinit = NULL;
 
-int
-sql_trace()
-{
-       keep_trace = !keep_trace;
-       return GDK_SUCCEED;
-}
-
 @= builtin_operand
 {
        int _k = interpret(stk, arg(lt, @1), res);
@@ -453,8 +445,10 @@
                if (language == 'X') {
                        int n, v, off, len;
 
-                       if (m->scanner.log) 
+                       if (m->scanner.log) {
                                stream_write(m->scanner.log, in->buf+in->pos, 
in->len - in->pos, 1);
+                               stream_write(m->scanner.log, "\n", 1, 1);
+                       }
 
                        n = sscanf(in->buf + in->pos, "export %d %d %d", &v, 
&off, &len);
 
@@ -931,13 +925,6 @@
        }
        GDKfree(schema);
 
-       if (keep_trace && !m->scanner.log) {
-               char fn[BUFSIZ];
-
-               snprintf(fn, BUFSIZ, "sql.%d", (int)(fc->c - monet_clients)); 
-               m->scanner.log = open_wastream(fn);
-       }
-
        /* shouldn't be needed to reset the myc variable ! */ 
         v = VARfind(&fc->stk, "myc");
         if (v == NULL) 
@@ -982,7 +969,7 @@
        res_tables_destroy(be->mvc->results);
        be->mvc->results = NULL;
 
-       if (keep_trace && be->mvc->scanner.log) 
+       if (be->mvc->scanner.log)
                stream_flush(be->mvc->scanner.log);
 }
 

Index: sql_server.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet4/sql_server.mx,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- sql_server.mx       16 Jan 2008 08:36:30 -0000      1.188
+++ sql_server.mx       28 Jan 2008 16:25:52 -0000      1.189
@@ -37,9 +37,6 @@
        .BUILTIN sql_frontend() : ptr = sql_frontend_wrap;
                "create/return the sql_frontend"
 
-       .COMMAND sql_trace() : void = sql_trace;
-               "enable/disable saving the sql statement traces (per client)" 
-
 @+ extra low level interface 
 @m
        .BUILTIN mvc_new() : mvc = mvc_new;
@@ -66,6 +63,8 @@
        .COMMAND mvc_sql( mvc m, str cmd ) = mvc_sql_wrap;
                "execute a sql query"
 
+       .COMMAND mvc_logfile(mvc m, str file) : void = mvc_logfile;
+               "enable/disable saving the sql statement traces" 
 
        .COMMAND declareVariable( mvc m, str varname, any::1 nl ) = 
declareVariable;
                "Declare a new session variable in the mvc structure"
@@ -451,8 +450,21 @@
        return GDK_SUCCEED;
 }
 
+int
+mvc_logfile(mvc *M, str filename)
+{
+       mvc *m = *(mvc**)M;
+
+       if (m->scanner.log) {
+               close_stream(m->scanner.log);
+               m->scanner.log = NULL;
+       }
+
+       if (filename != str_nil) 
+               m->scanner.log = open_wastream(filename);
+       return GDK_SUCCEED;
+}
 
-/* TODO pass also the schema name */
 int
 mvc_next_value(lng *res, mvc *C, str sname, str seqname)
 {
@@ -1579,6 +1591,9 @@
 
 # forward reference, will be filled in the sql session 
 var myc := mvc(ptr(nil));
+proc logfile( str filename) : void {
+       return mvc_logfile(myc, filename);
+}
 proc next_value( str sname, str v ) : lng {
        return mvc_next_value(myc, sname, v);
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to