diff options
author | Ziv Scully <ziv@mit.edu> | 2015-11-19 03:45:39 -0500 |
---|---|---|
committer | Ziv Scully <ziv@mit.edu> | 2015-11-19 03:45:39 -0500 |
commit | 0c231060050adf556348b06f078c994f4a0e65b4 (patch) | |
tree | f88b73ae276f7df0a9a7543b8d9569312d9fb2a5 /src/sql.sml | |
parent | bfcd84434ee997b474935aa13ae7bc1f3801d795 (diff) |
Fix SQL parser JOIN bug and fix ON clause logic in Sqlcache.
Diffstat (limited to 'src/sql.sml')
-rw-r--r-- | src/sql.sml | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/sql.sml b/src/sql.sml index 16d4210c..dfe2f968 100644 --- a/src/sql.sml +++ b/src/sql.sml @@ -384,12 +384,6 @@ val select = log "select" datatype jtype = Inner | Left | Right | Full -val jtype = wrap (ws (follow (opt (altL [wrap (const "LEFT") (fn () => Left), - wrap (const "RIGHT") (fn () => Right), - wrap (const "FULL") (fn () => Full)])) - (const " JOIN "))) - (fn (SOME jt, ()) => jt | (NONE, ()) => Inner) - datatype fitem = Table of string * string (* table AS name *) | Join of jtype * fitem * fitem * sqexp @@ -404,17 +398,22 @@ val wher = wrap (follow (ws (const "WHERE ")) sqexp) val orderby = log "orderby" (wrap (follow (ws (const "ORDER BY ")) - (follow (list sqexp) - (opt (ws (const "DESC"))))) + (list (follow sqexp + (opt (ws (const "DESC")))))) ignore) +val jtype = altL [wrap (const "JOIN") (fn () => Inner), + wrap (const "LEFT JOIN") (fn () => Left), + wrap (const "RIGHT JOIN") (fn () => Right), + wrap (const "FULL JOIN") (fn () => Full)] + fun fitem chs = altL [wrap (follow uw_ident (follow (const " AS ") t_ident)) (fn (t, ((), f)) => Table (t, f)), wrap (follow (const "(") (follow fitem - (follow jtype + (follow (ws jtype) (follow fitem (follow (const " ON ") (follow sqexp |