diff --git a/Language/SQL/SimpleSQL/Parse.lhs b/Language/SQL/SimpleSQL/Parse.lhs index 0ef328a..6c024cc 100644 --- a/Language/SQL/SimpleSQL/Parse.lhs +++ b/Language/SQL/SimpleSQL/Parse.lhs @@ -719,16 +719,10 @@ all the scalar expressions which start with an identifier > idenExpr = > -- todo: work out how to left factor this > try (TypedLit <$> typeName <*> singleQuotesOnlyStringTok) -> <|> multisetSetFunction +> -- <|> multisetSetFunction > <|> (try keywordFunction <**> app) > <|> (names <**> option Iden app) > where -> -- this is a special case because set is a reserved keyword -> -- and the names parser won't parse it -> multisetSetFunction = -> App [Name Nothing "set"] . (:[]) <$> -> (try (keyword_ "set" *> openParen) -> *> scalarExpr <* closeParen) > keywordFunction = > let makeKeywordFunction x = if map toLower x `elem` keywordFunctionNames > then return [Name Nothing x] @@ -783,6 +777,7 @@ all the scalar expressions which start with an identifier > ,"regr_syy" > ,"row" > ,"row_number" +> ,"set" > ,"some" > ,"stddev_pop" > ,"stddev_samp" @@ -2293,7 +2288,7 @@ not, leave them unreserved for now > ,"current_row" > ,"current_schema" > ,"current_time" -> ,"current_timestamp" +> --,"current_timestamp" > ,"current_transform_group_for_type" > --,"current_user" > ,"cursor" diff --git a/TODO b/TODO index b3d9254..20cdc6b 100644 --- a/TODO +++ b/TODO @@ -33,7 +33,12 @@ themselves review main missing sql bits - focus on more mainstream things could also review main dialects -review the dialect support implementation +** review the dialect support implementation +-> how to create your own dialects + especially how to override the reserved keyword list easily + make a list of the current dialect specific things + review the reserved word handling and make some more tests + add negative parsing tests for things that should fail syntax from hssqlppp: diff --git a/simple-sql-parser.cabal b/simple-sql-parser.cabal index b223176..d73f054 100644 --- a/simple-sql-parser.cabal +++ b/simple-sql-parser.cabal @@ -1,5 +1,5 @@ name: simple-sql-parser -version: 0.5.0 +version: 0.5.1 synopsis: A parser for SQL. description: diff --git a/tools/Language/SQL/SimpleSQL/QueryExprs.lhs b/tools/Language/SQL/SimpleSQL/QueryExprs.lhs index f2213e2..deb25cd 100644 --- a/tools/Language/SQL/SimpleSQL/QueryExprs.lhs +++ b/tools/Language/SQL/SimpleSQL/QueryExprs.lhs @@ -13,6 +13,12 @@ query expressions from one string. > ,("select 1;",[ms]) > ,("select 1;select 1",[ms,ms]) > ,(" select 1;select 1; ",[ms,ms]) +> ,("SELECT CURRENT_TIMESTAMP;" +> ,[SelectStatement $ makeSelect +> {qeSelectList = [(Iden [Name Nothing "CURRENT_TIMESTAMP"],Nothing)]}]) +> ,("SELECT \"CURRENT_TIMESTAMP\";" +> ,[SelectStatement $ makeSelect +> {qeSelectList = [(Iden [Name (Just ("\"","\"")) "CURRENT_TIMESTAMP"],Nothing)]}]) > ] > where > ms = SelectStatement $ makeSelect {qeSelectList = [(NumLit "1",Nothing)]}