Update of /cvsroot/monetdb/sql/src/server
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26863/src/server

Modified Files:
        sql_parser.mx 
Log Message:
propagated changes of Thursday Aug 06 2009 - Friday Aug 07 2009
from the Aug2009 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/08/06 - nielsnes: src/server/sql_parser.mx,1.312.2.4
don't allow values( select xxx).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/08/06 - nielsnes: src/server/sql_parser.mx,1.312.2.5
added power operator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: sql_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_parser.mx,v
retrieving revision 1.315
retrieving revision 1.316
diff -u -d -r1.315 -r1.316
--- sql_parser.mx       5 Aug 2009 08:51:47 -0000       1.315
+++ sql_parser.mx       7 Aug 2009 13:31:12 -0000       1.316
@@ -508,8 +508,8 @@
        end_field
        single_datetime_field
        interval_qualifier
-       scalar_exp_list2
-       case_scalar_exp_list2
+       scalar_exp_list
+       case_scalar_exp_list
        when_value_list
        when_search_list
        opt_seps
@@ -679,7 +679,7 @@
 %left <sval> COMPARISON /* <> < > <= >= */
 %left <operation> '='
 %left <operation> '+' '-'
-%left <operation> '*' '/' '%'
+%left <operation> '*' '/' '%' '^'
 %left <operation> SUBSTRING CONCATSTRING POSITION
 %right UMINUS
 
@@ -835,7 +835,7 @@
     ;
 
 set_statement:
-       set ident '=' scalar_exp
+       set ident '=' simple_atom
                { dlist *l = L();
                append_string(l, $2 );
                append_symbol(l, $4 );
@@ -2685,7 +2685,6 @@
 
 insert_atom:
     simple_atom
- |  select_no_parens_orderby
  ;
 
 value:
@@ -3295,6 +3294,13 @@
                          append_symbol(l, $1);
                          append_symbol(l, $3);
                          $$ = _symbol_create_list( SQL_BINOP, l ); }
+ |  scalar_exp '^' scalar_exp
+                       { dlist *l = L();
+                         append_list(l, 
+                               append_string(L(), sa_strdup(SA, "power")));
+                         append_symbol(l, $1);
+                         append_symbol(l, $3);
+                         $$ = _symbol_create_list( SQL_BINOP, l ); }
  |  '+' scalar_exp %prec UMINUS 
                        { $$ = $2; }
  |  '-' scalar_exp %prec UMINUS 
@@ -3417,22 +3423,21 @@
        { dlist *l = L();
          append_list(l, $1);
          $$ = _symbol_create_list( SQL_OP, l ); }
-|   qfunc '(' scalar_exp ')'
-       { dlist *l = L();
-         append_list(l, $1);
-         append_symbol(l, $3);
-         $$ = _symbol_create_list( SQL_UNOP, l ); }
-|   qfunc '(' scalar_exp ',' scalar_exp ')'
-       { dlist *l = L();
-         append_list(l, $1);
-         append_symbol(l, $3);
-         append_symbol(l, $5);
-         $$ = _symbol_create_list( SQL_BINOP, l ); }
-|   qfunc '(' scalar_exp_list2 ')'
+|   qfunc '(' scalar_exp_list ')'
        { dlist *l = L();
          append_list(l, $1);
-         append_list(l, $3);
-         $$ = _symbol_create_list( SQL_NOP, l ); }
+         if (dlist_length($3) == 1) {
+               append_symbol(l, $3->h->data.sym);
+               $$ = _symbol_create_list( SQL_UNOP, l ); 
+         } else if (dlist_length($3) == 2) {
+               append_symbol(l, $3->h->data.sym);
+               append_symbol(l, $3->h->next->data.sym);
+               $$ = _symbol_create_list( SQL_BINOP, l ); 
+         } else {
+               append_list(l, $3);
+               $$ = _symbol_create_list( SQL_NOP, l ); 
+         }
+       }
  ;
 
 qfunc:
@@ -4095,12 +4100,7 @@
                   append_symbol(
                    append_symbol(
                     L(), $3), $5)); }
- |   COALESCE '(' case_scalar_exp ',' case_scalar_exp ')'
-               { $$ = _symbol_create_list(SQL_COALESCE,
-                  append_symbol(
-                   append_symbol(
-                    L(), $3), $5)); }
- |   COALESCE '(' case_scalar_exp_list2 ')'
+ |   COALESCE '(' case_scalar_exp_list ')'
                { $$ = _symbol_create_list(SQL_COALESCE, $3); }
  |   CASE scalar_exp when_value_list case_opt_else END
                { $$ = _symbol_create_list(SQL_CASE,
@@ -4115,23 +4115,19 @@
                     L(),$2),$3)); }
  ;
 
-scalar_exp_list2:
-    scalar_exp ',' scalar_exp ',' scalar_exp
-                       { $$ = append_symbol( L(), $1);
-                         $$ = append_symbol( $$, $3);
-                         $$ = append_symbol( $$, $5);
-                       }
- |  scalar_exp_list2 ',' scalar_exp
+scalar_exp_list:
+    simple_atom
+                       { $$ = append_symbol( L(), $1); }
+ |  scalar_exp_list ',' simple_atom
                        { $$ = append_symbol( $1, $3); }
  ;
 
-case_scalar_exp_list2:
-    case_scalar_exp ',' case_scalar_exp ',' case_scalar_exp
+case_scalar_exp_list: /* at least 2 scalar_exp (or null) */
+    simple_atom ',' simple_atom
                        { $$ = append_symbol( L(), $1);
                          $$ = append_symbol( $$, $3);
-                         $$ = append_symbol( $$, $5);
                        }
- |  case_scalar_exp_list2 ',' case_scalar_exp
+ |  case_scalar_exp_list ',' simple_atom
                        { $$ = append_symbol( $1, $3); }
  ;
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to