diff src/urweb.grm @ 441:c5335613f31e

CURRENT_TIMESTAMP
author Adam Chlipala <adamc@hcoop.net>
date Thu, 30 Oct 2008 15:33:28 -0400
parents c471345f5165
children dfc8c991abd0
line wrap: on
line diff
--- a/src/urweb.grm	Thu Oct 30 15:16:37 2008 -0400
+++ b/src/urweb.grm	Thu Oct 30 15:33:28 2008 -0400
@@ -154,6 +154,13 @@
         (EApp (e, sqlexp2), loc)
     end
 
+fun sql_nfunc (oper, loc) =
+    let
+        val e = (EVar (["Basis"], "sql_nfunc", Infer), loc)
+    in
+        (EApp (e, (EVar (["Basis"], "sql_" ^ oper, Infer), loc)), loc)
+    end
+
 fun native_unop (oper, e1, loc) =
     let
         val e = (EVar (["Basis"], oper, Infer), loc)
@@ -206,6 +213,7 @@
  | COUNT | AVG | SUM | MIN | MAX
  | ASC | DESC
  | INSERT | INTO | VALUES | UPDATE | SET | DELETE
+ | CURRENT_TIMESTAMP
  | NE | LT | LE | GT | GE
 
 %nonterm
@@ -1169,6 +1177,8 @@
                                                      s (FLOATleft, FLOATright)))
        | STRING                         (sql_inject (EPrim (Prim.String STRING),
                                                      s (STRINGleft, STRINGright)))
+       | CURRENT_TIMESTAMP              (sql_nfunc ("current_timestamp",
+                                                    s (CURRENT_TIMESTAMPleft, CURRENT_TIMESTAMPright)))
 
        | tident DOT fident              (let
                                              val loc = s (tidentleft, fidentright)