diff src/urweb.grm @ 1602:e44be6ece475

COALESCE
author Adam Chlipala <adam@chlipala.net>
date Sat, 19 Nov 2011 10:43:57 -0500
parents 911ebbd23919
children da788bd72c9e
line wrap: on
line diff
--- a/src/urweb.grm	Sat Nov 19 10:26:19 2011 -0500
+++ b/src/urweb.grm	Sat Nov 19 10:43:57 2011 -0500
@@ -244,7 +244,7 @@
  | TRUE | FALSE | CAND | OR | NOT
  | COUNT | AVG | SUM | MIN | MAX
  | ASC | DESC
- | INSERT | INTO | VALUES | UPDATE | SET | DELETE | NULL | IS
+ | INSERT | INTO | VALUES | UPDATE | SET | DELETE | NULL | IS | COALESCE
  | CURRENT_TIMESTAMP
  | NE | LT | LE | GT | GE
  | CCONSTRAINT | UNIQUE | CHECK | PRIMARY | FOREIGN | KEY | ON | NO | ACTION | RESTRICT | CASCADE | REFERENCES
@@ -1881,6 +1881,14 @@
                                          in
                                              (EApp (e, sqlexp), loc)
                                          end)
+       | COALESCE LPAREN sqlexp COMMA sqlexp RPAREN
+                                        (let
+                                             val loc = s (COALESCEright, sqlexp2right)
+                                             val e = (EVar (["Basis"], "sql_coalesce", Infer), loc)
+                                             val e = (EApp (e, sqlexp1), loc)
+                                         in
+                                             (EApp (e, sqlexp2), loc)
+                                         end)
        | fname LPAREN sqlexp RPAREN     (let
                                              val loc = s (fnameleft, RPARENright)