summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-21 16:03:45 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-21 16:03:45 -0400
commita8a9ea33b3e9b7d072f0843ba3bb709a4a3eb7a9 (patch)
treed14fa20d4fc3425da7e101a034526dd98dd22d1a /src
parent535d72045b35d01cf4513af273262c3c50c219fe (diff)
OFFSET
Diffstat (limited to 'src')
-rw-r--r--src/lacweb.grm17
-rw-r--r--src/lacweb.lex1
2 files changed, 15 insertions, 3 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm
index 0809842d..4352fa8c 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -164,7 +164,7 @@ fun sql_relop (oper, sqlexp1, sqlexp2, loc) =
| SELECT | FROM | AS | CWHERE | GROUP | ORDER | BY | HAVING
| UNION | INTERSECT | EXCEPT
- | LIMIT | OFFSET
+ | LIMIT | OFFSET | ALL
| TRUE | FALSE | CAND | OR | NOT
| NE | LT | LE | GT | GE
@@ -247,6 +247,7 @@ fun sql_relop (oper, sqlexp1, sqlexp2, loc) =
| obopt of exp
| obexps of exp
| lopt of exp
+ | ofopt of exp
| sqlint of exp
@@ -661,7 +662,7 @@ attrv : INT (EPrim (Prim.Int INT), s (INTleft, INTri
| STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
| LBRACE eexp RBRACE (eexp)
-query : query1 obopt lopt (let
+query : query1 obopt lopt ofopt (let
val loc = s (query1left, query1right)
val re = (ERecord [((CName "Rows", loc),
@@ -669,7 +670,9 @@ query : query1 obopt lopt (let
((CName "OrderBy", loc),
obopt),
((CName "Limit", loc),
- lopt)], loc)
+ lopt),
+ ((CName "Offset", loc),
+ ofopt)], loc)
in
(EApp ((EVar (["Basis"], "sql_query"), loc), re), loc)
end)
@@ -851,11 +854,19 @@ obexps : sqlexp (let
end)
lopt : (EVar (["Basis"], "sql_no_limit"), dummy)
+ | LIMIT ALL (EVar (["Basis"], "sql_no_limit"), dummy)
| LIMIT sqlint (let
val loc = s (LIMITleft, sqlintright)
in
(EApp ((EVar (["Basis"], "sql_limit"), loc), sqlint), loc)
end)
+ofopt : (EVar (["Basis"], "sql_no_offset"), dummy)
+ | OFFSET sqlint (let
+ val loc = s (OFFSETleft, sqlintright)
+ in
+ (EApp ((EVar (["Basis"], "sql_offset"), loc), sqlint), loc)
+ end)
+
sqlint : INT (EPrim (Prim.Int INT), s (INTleft, INTright))
| LBRACE eexp RBRACE (eexp)
diff --git a/src/lacweb.lex b/src/lacweb.lex
index 8ec07c41..f67eada7 100644
--- a/src/lacweb.lex
+++ b/src/lacweb.lex
@@ -311,6 +311,7 @@ notags = [^<{\n]+;
<INITIAL> "HAVING" => (Tokens.HAVING (pos yypos, pos yypos + size yytext));
<INITIAL> "LIMIT" => (Tokens.LIMIT (pos yypos, pos yypos + size yytext));
<INITIAL> "OFFSET" => (Tokens.OFFSET (pos yypos, pos yypos + size yytext));
+<INITIAL> "ALL" => (Tokens.ALL (pos yypos, pos yypos + size yytext));
<INITIAL> "UNION" => (Tokens.UNION (pos yypos, pos yypos + size yytext));
<INITIAL> "INTERSECT" => (Tokens.INTERSECT (pos yypos, pos yypos + size yytext));