Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1818/src/server

Modified Files:
      Tag: SQL_2-22
        sql_select.mx 
Log Message:
flattening queries doesn't depend on aliases.


Index: sql_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_select.mx,v
retrieving revision 1.219.2.4
retrieving revision 1.219.2.5
diff -u -d -r1.219.2.4 -r1.219.2.5
--- sql_select.mx       20 Feb 2008 10:44:59 -0000      1.219.2.4
+++ sql_select.mx       26 Feb 2008 21:50:53 -0000      1.219.2.5
@@ -2705,21 +2705,21 @@
 
        if (!s)
                return NULL;
+       /* flatten subqueries */
+       if (s->type == st_list && 
+           list_length(s->op1.lval) == 2 && f == sql_sel) {
+               stmt *h, *v = stmt_dup(s->op1.lval->h->data);
+               stmt *o = stmt_dup(s->op1.lval->h->next->data);
+               stmt_destroy(s);
+               s = stmt_join(stmt_reverse(o), v, cmp_equal);
+               h = stmt_dup(s->h->t);
+               stmt_destroy(s->h);
+               s->h = h;
+               if (f >= sql_sel)   /* make sure we don't lose rows */
+                       s = stmt_outerjoin(stmt_mirror(first_subset(subset)), 
s, cmp_equal);
+       }
        /* AS name */
        if (s && l->h->next->data.sval) {
-               /* flatten subqueries */
-               if (s->type == st_list && 
-                   list_length(s->op1.lval) == 2 && f == sql_sel) {
-                       stmt *h, *v = stmt_dup(s->op1.lval->h->data);
-                       stmt *o = stmt_dup(s->op1.lval->h->next->data);
-                       stmt_destroy(s);
-                       s = stmt_join(stmt_reverse(o), v, cmp_equal);
-                       h = stmt_dup(s->h->t);
-                       stmt_destroy(s->h);
-                       s->h = h;
-                       if (f >= sql_sel)   /* make sure we don't lose rows */
-                               s = 
stmt_outerjoin(stmt_mirror(first_subset(subset)), s, cmp_equal);
-               }
                s = stmt_alias(s, table_name(s), 
_strdup(l->h->next->data.sval));
                scope_add_alias(scp, stmt_dup(s), l->h->next->data.sval);
        }


-------------------------------------------------------------------------
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