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

Modified Files:
        sql_gencode.mx 
Log Message:
propagated changes of Tuesday Jul 15 2008 - Thursday Jul 17 2008
from the SQL_2-24 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/07/15 - nielsnes: src/backends/monet5/sql_gencode.mx,1.275.2.5
we need to drop declared tables when we leave the scope.
THis fixes bug mdb_starts_with_sql_debug_64.SF-1999354.sql.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.280
retrieving revision 1.281
diff -u -d -r1.280 -r1.281
--- sql_gencode.mx      13 Jul 2008 14:54:45 -0000      1.280
+++ sql_gencode.mx      17 Jul 2008 13:28:47 -0000      1.281
@@ -200,6 +200,16 @@
        return nr;
 }
 
+static int
+drop_table(MalBlkPtr mb, str n)
+{
+       InstrPtr k = newStmt1(mb, sqlRef, "dropDeclaredTable");
+       int nr = getDestVar(k);
+
+       k = pushStr(mb, k, n);
+       return nr;
+}
+
 
 @-
 The dump_cols produces a sequence of instructions for
@@ -1814,6 +1824,11 @@
                case st_return: {
                        int c = _dumpstmt(sql,mb, s->op1.stval);
                        int tt = tail_type(s->op1.stval)->type->localtype;
+
+                       if (s->flag) { /* drop declared tables */
+                               InstrPtr k = newStmt1(mb, sqlRef, 
"dropDeclaredTables");
+                               k = pushInt(mb, k, s->flag);
+                       } 
                        q = newInstruction(mb,RETURNsymbol);
                        if (tt == TYPE_bat) {
                                tt = newBatType(TYPE_str,TYPE_bat);
@@ -1825,11 +1840,19 @@
                        pushInstruction(mb, q);
                }       break;
                case st_assign: {
-                       int r = _dumpstmt(sql,mb, s->op2.stval);
+                       int r = -1;
+
+                       if (s->op2.stval)
+                               r = _dumpstmt(sql,mb, s->op2.stval);
                        if (!VAR_GLOBAL(s->flag)) { /* globals */
-                               char *vn = atom2string(s->op1.stval->op1.aval);
-                               char *buf;
+                               char *buf, *vn = 
atom2string(s->op1.stval->op1.aval);
 
+                               if (!s->op2.stval) {
+                                       /* drop declared table */
+                                       s->nr = drop_table(mb, vn);
+                                       _DELETE(vn);
+                                       break;
+                               }
                                buf = alloca(SMALLBUFSIZ);
                                (void) snprintf(buf, SMALLBUFSIZ, "A%s", vn);
                                q = newInstruction(mb,ASSIGNsymbol);


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to