Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28474
Modified Files:
Tag: Nov2009
sql_scenario.mx
Log Message:
Introduce the trace global variable. Allow for keeping the result of
a traced call for querying as if it was a SQL table.[todo]
Index: sql_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_scenario.mx,v
retrieving revision 1.356.2.4
retrieving revision 1.356.2.5
diff -u -d -r1.356.2.4 -r1.356.2.5
--- sql_scenario.mx 24 Oct 2009 21:06:56 -0000 1.356.2.4
+++ sql_scenario.mx 25 Oct 2009 10:03:36 -0000 1.356.2.5
@@ -308,6 +308,7 @@
if (optimizer == NULL)
optimizer= "default_pipe";
SQLglobal("optimizer", setOptimizers(optimizer));
+ SQLglobal("trace","ticks,statement");
typename = "sec_interval";
sql_find_subtype(&ctype, typename, 0, 0);
@@ -317,6 +318,7 @@
sql_find_subtype(&ctype, typename, 0, 0);
SQLglobal("cache", &T);
SQLglobal("history", &F);
+
return 0;
}
@@ -862,10 +864,14 @@
and creates a secondary result set upon termination
of the query. This feature is extended with
a SQL variable to identify which trace flags are needed.
+The control term 'keep' avoids clearing the performance tables,
+which makes it possible to inspect the results later using
+SQL itself. (Script needed to bind the BATs to a SQL table.)
@c
void
SQLsetTrace(backend *be, Client c, bit onoff)
{
+ int i = 0;
InstrPtr q,r;
MalBlkPtr mb = c->curprg->def;
str traceFlag, t,s, def= GDKstrdup("ticks,statement");
@@ -878,7 +884,8 @@
t= def;
if (onoff){
- q = newStmt(mb,"profiler","reset");
+ if ( strstr(def,"keep") == 0)
+ q = newStmt(mb,"profiler","reset");
q = newStmt(mb,"profiler","activate");
do {
@@ -886,7 +893,8 @@
t= strchr(t+1,',');
if ( t )
*t = 0;
- q = pushStr(mb, q, s);
+ if ( strcmp("keep",s) )
+ q = pushStr(mb, q, s);
} while (t++);
q = newStmt(mb,"profiler","setFilter");
@@ -896,7 +904,6 @@
} else {
r= newInstruction(mb,ASSIGNsymbol);
setModuleId(r,putName("io",2));
- setFunctionId(r,putName("table",5));
getArg(r,0)= newTmpVariable(mb,TYPE_void);
q = newStmt(mb,"profiler","stop");
@@ -905,10 +912,17 @@
t= strchr(t+1,',');
if ( t )
*t = 0;
- q = newStmt(mb,"profiler","getTrace");
- q = pushStr(mb, q, s);
- r= pushArgument(mb,r, getArg(q,0));
+ if ( strcmp("keep",s) ) {
+ q = newStmt(mb,"profiler","getTrace");
+ q = pushStr(mb, q, s);
+ r= pushArgument(mb,r, getArg(q,0));
+ i++;
+ }
} while (t++);
+ if ( i > 1)
+ setFunctionId(r,putName("table",5));
+ else
+ setFunctionId(r,putName("print",5));
pushInstruction(mb,r);
}
GDKfree(def);
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins