Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21841/src/server
Modified Files:
sql_psm.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/server/sql_psm.mx,1.53.2.2
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_psm.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_psm.mx,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- sql_psm.mx 5 Jun 2008 09:23:23 -0000 1.54
+++ sql_psm.mx 17 Jul 2008 13:29:12 -0000 1.55
@@ -358,7 +358,23 @@
res = sql_value_exp(sql, scp, return_sym, NULL, NULL, sql_sel, ek);
if (!res || (res = check_types(sql, restype, res, type_equal)) == NULL)
return NULL;
- return stmt_return(res);
+ return stmt_return(res, stack_nr_of_declared_tables(sql));
+}
+
+static int
+has_return(stmt *s )
+{
+ if (s->type == st_return) {
+ return 1;
+ } else if (s->type == st_if) {
+ int res = has_return(s->op2.stval); /* ifstmts */
+ if (res && s->op3.stval)
+ res = has_return(s->op3.stval); /* elsestmts */
+ return res;
+ } else if (s->type == st_list) { /* sequential block */
+ return has_return(s->op1.lval->t->data);
+ }
+ return 0;
}
stmt *
@@ -366,6 +382,7 @@
{
list *l=0;
dnode *n;
+ int i;
if (THRhighwater())
return sql_error(sql, 10, "SELECT: too many nested operators");
@@ -376,6 +393,7 @@
for (n = blk->h; n; n = n->next ) {
stmt *res = NULL;
symbol *s = n->data.sym;
+
switch (s->token) {
case SQL_SET:
res = psm_set(sql, scp, s->data.lval->h);
@@ -435,6 +453,16 @@
}
list_append(l, res);
}
+ /* drop the declared tables of this frame */
+ if (l && l->t && !has_return(l->t->data)) {
+ i = sql->topvars;
+ while(sql->vars[--i].s) {
+ sql_var *v = &sql->vars[i];
+
+ if (v->type.comp_type && !v->view)
+ list_append(l, stmt_assign(v->name, NULL,
sql->frame));
+ }
+ }
stack_pop_frame(sql);
if (l)
return stmt_list(l);
@@ -477,22 +505,6 @@
return NULL;
}
-static int
-has_return(stmt *s )
-{
- if (s->type == st_return) {
- return 1;
- } else if (s->type == st_if) {
- int res = has_return(s->op2.stval); /* ifstmts */
- if (res && s->op3.stval)
- res = has_return(s->op3.stval); /* elsestmts */
- return res;
- } else if (s->type == st_list) { /* sequential block */
- return has_return(s->op1.lval->t->data);
- }
- return 0;
-}
-
list *
create_type_list(dlist *params, int param)
{
-------------------------------------------------------------------------
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