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

Modified Files:
      Tag: SQL_2-18
        sql_optimizer.mx 
Log Message:
Backpropagation. Set the global SQL variable optimizer to the result
after interpretation. Solve the bug that after SET optimizer='off'
you can not turn it on again. 


Index: sql_optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_optimizer.mx,v
retrieving revision 1.155
retrieving revision 1.155.2.1
diff -u -d -r1.155 -r1.155.2.1
--- sql_optimizer.mx    1 Jun 2007 06:49:02 -0000       1.155
+++ sql_optimizer.mx    29 Jun 2007 05:44:29 -0000      1.155.2.1
@@ -100,6 +100,16 @@
 quite some (expensive) instructions can be safed.
 The current heuristic is geared at avoiding trivial
 factory structures.
[EMAIL PROTECTED]
[EMAIL PROTECTED] SQLglobal
+{      sql_subtype ctype;
+       stmt *r;
+    ValRecord src;
+       sql_find_subtype(&ctype, "varchar", 1024, 0);
+       r = stmt_var(_strdup(@1), &ctype, 0, 1);
+       stack_push_var(be->mvc, @1, r, &ctype);
+       stack_set_var(be->mvc, @1, VALset(&src, ctype.type->localtype, @2));
+}
 @c
 #include "sql_config.h"
 #include "mal_builder.h"
@@ -413,7 +423,7 @@
        /* "joinselect," */
        "accessmode,"
        "aliases,"
-       /* "crackers," */
+       /* "crack," */
        "commonTerms,"
        "accumulators,"
        "joinPath,"
@@ -495,7 +505,7 @@
                optimizer= defaultPlan;
 #ifdef _SQL_OPTIMIZER_DEBUG
        if( optimizer)
-               stream_printf(c->fdout,"optimizer=%s\n",optimizer);
+       stream_printf(c->fdout,"optimizer:%s:\n",optimizer?optimizer:"unknown");
 #endif
 @-
 A few optimizations are always needed. First, the multiplex
@@ -505,13 +515,23 @@
 expand the macros (unless this has already been taken
 care of.
 @c
+       if( strcmp(optimizer,"on")==0 ||
+               strcmp(optimizer,"default")==0 ){ 
+               str base = GDKstrdup(defaultPlan);
+               @:SQLglobal("optimizer", defaultPlan)@
+               addOptimizers(c,mb, base);
+               optimizeMALBlock(mb);
+               GDKfree(base);
+       } else
        if( strcmp(optimizer,"off")==0 ){ 
+               str base = GDKstrdup(minimalPlan);
+               @:SQLglobal("optimizer", minimalPlan)@
                /* no real optimization needed */
-               addOptimizers(c,mb, minimalPlan);
+               addOptimizers(c,mb, base);
                optimizeMALBlock(mb);
+               GDKfree(base);
        } else {
-               str base;
-               base= GDKstrdup(optimizer);
+               str base = GDKstrdup(optimizer);
                addOptimizers(c,mb,base);
                GDKfree(base);
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to