Update of /cvsroot/monetdb/sql/src/server
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22866/server
Modified Files:
Tag: Aug2009
sql_parser.mx sql_scan.mx
Log Message:
added power operator
U sql_scan.mx
Index: sql_scan.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_scan.mx,v
retrieving revision 1.151
retrieving revision 1.151.2.1
diff -u -d -r1.151 -r1.151.2.1
--- sql_scan.mx 1 Aug 2009 14:47:46 -0000 1.151
+++ sql_scan.mx 6 Aug 2009 21:43:06 -0000 1.151.2.1
@@ -792,6 +792,7 @@
return scanner_token(lc, cur);
case '?':
case '%':
+ case '^':
case '+':
case '*':
case '/':
U sql_parser.mx
Index: sql_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_parser.mx,v
retrieving revision 1.312.2.4
retrieving revision 1.312.2.5
diff -u -d -r1.312.2.4 -r1.312.2.5
--- sql_parser.mx 6 Aug 2009 20:06:45 -0000 1.312.2.4
+++ sql_parser.mx 6 Aug 2009 21:43:05 -0000 1.312.2.5
@@ -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 );
@@ -3294,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
@@ -3416,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:
@@ -4094,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,
@@ -4114,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