diff src/urweb.grm @ 1682:ac141fbb313a

'ORDER BY RANDOM' (based on a patch from Ron de Bruijn)
author Adam Chlipala <adam@chlipala.net>
date Thu, 02 Feb 2012 11:40:10 -0500
parents 570636457047
children 9dd8d47c3e58
line wrap: on
line diff
--- a/src/urweb.grm	Sun Jan 22 20:25:14 2012 -0500
+++ b/src/urweb.grm	Thu Feb 02 11:40:10 2012 -0500
@@ -276,7 +276,7 @@
  | LIMIT | OFFSET | ALL
  | TRUE | FALSE | CAND | OR | NOT
  | COUNT | AVG | SUM | MIN | MAX
- | ASC | DESC
+ | ASC | DESC | RANDOM
  | INSERT | INTO | VALUES | UPDATE | SET | DELETE | NULL | IS | COALESCE | LIKE
  | CURRENT_TIMESTAMP
  | NE | LT | LE | GT | GE
@@ -405,6 +405,7 @@
  | obopt of exp
  | obitem of exp * exp
  | obexps of exp
+ | popt of unit
  | diropt of exp
  | lopt of exp
  | ofopt of exp
@@ -2034,6 +2035,10 @@
                                          in
                                              (EApp (e, obexps), loc)
                                          end)
+       | RANDOM popt                    (EVar (["Basis"], "sql_order_by_random", Infer), s (RANDOMleft, poptright))
+
+popt   :                                ()
+       | LPAREN RPAREN                  ()
 
 diropt :                                (EVar (["Basis"], "sql_asc", Infer), dummy)
        | ASC                            (EVar (["Basis"], "sql_asc", Infer), s (ASCleft, ASCright))