update website
This commit is contained in:
parent
2fd285e670
commit
0460c237e5
4
TODO
4
TODO
|
@ -1,3 +1,7 @@
|
||||||
|
This file is completely out of date.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
medium tasks next release
|
medium tasks next release
|
||||||
|
|
||||||
review alters, and think about adding rename versions
|
review alters, and think about adding rename versions
|
||||||
|
|
|
@ -15,7 +15,6 @@ import Language.SQL.SimpleSQL.Parse
|
||||||
import Language.SQL.SimpleSQL.Syntax (Statement)
|
import Language.SQL.SimpleSQL.Syntax (Statement)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
|
|
|
@ -94,13 +94,27 @@ Parsed AST:
|
||||||
|
|
||||||
[source,haskell]
|
[source,haskell]
|
||||||
----
|
----
|
||||||
Select{qeSetQuantifier = All,
|
Select
|
||||||
qeSelectList =
|
{ qeSetQuantifier = SQDefault
|
||||||
[(BinOp (Iden (Name "a")) (Name "+")
|
, qeSelectList =
|
||||||
(BinOp (Iden (Name "b")) (Name "*") (Iden (Name "c"))),
|
[ ( BinOp
|
||||||
Nothing)],
|
(Iden [ Name Nothing "a" ])
|
||||||
qeFrom = [], qeWhere = Nothing, qeGroupBy = [], qeHaving = Nothing,
|
[ Name Nothing "+" ]
|
||||||
qeOrderBy = [], qeOffset = Nothing, qeFetchFirst = Nothing}
|
(BinOp
|
||||||
|
(Iden [ Name Nothing "b" ])
|
||||||
|
[ Name Nothing "*" ]
|
||||||
|
(Iden [ Name Nothing "c" ]))
|
||||||
|
, Nothing
|
||||||
|
)
|
||||||
|
]
|
||||||
|
, qeFrom = []
|
||||||
|
, qeWhere = Nothing
|
||||||
|
, qeGroupBy = []
|
||||||
|
, qeHaving = Nothing
|
||||||
|
, qeOrderBy = []
|
||||||
|
, qeOffset = Nothing
|
||||||
|
, qeFetchFirst = Nothing
|
||||||
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
TPC-H query 21:
|
TPC-H query 21:
|
||||||
|
@ -153,15 +167,23 @@ Parsed:
|
||||||
|
|
||||||
[source,haskell]
|
[source,haskell]
|
||||||
----
|
----
|
||||||
Select{qeSetQuantifier = All,
|
Select
|
||||||
qeSelectList =
|
{ qeSetQuantifier = SQDefault
|
||||||
[(Iden (Name "s_name"), Nothing),
|
, qeSelectList =
|
||||||
(App (Name "count") [Star], Just (Name "numwait"))],
|
[ ( Iden [ Name Nothing "s_name" ] , Nothing )
|
||||||
qeFrom =
|
, ( App [ Name Nothing "count" ] [ Star ]
|
||||||
[TRSimple (Name "supplier"),
|
, Just (Name Nothing "numwait")
|
||||||
TRAlias (TRSimple (Name "lineitem")) (Alias (Name "l1") Nothing),
|
)
|
||||||
TRSimple (Name "orders"), TRSimple (Name "nation")],
|
]
|
||||||
qeWhere =
|
, qeFrom =
|
||||||
|
[ TRSimple [ Name Nothing "supplier" ]
|
||||||
|
, TRAlias
|
||||||
|
(TRSimple [ Name Nothing "lineitem" ])
|
||||||
|
(Alias (Name Nothing "l1") Nothing)
|
||||||
|
, TRSimple [ Name Nothing "orders" ]
|
||||||
|
, TRSimple [ Name Nothing "nation" ]
|
||||||
|
]
|
||||||
|
, qeWhere =
|
||||||
Just
|
Just
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
|
@ -170,90 +192,114 @@ Select{qeSetQuantifier = All,
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "s_suppkey")) (Name "=")
|
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
|
||||||
(Iden (Name "l_suppkey"))))
|
|
||||||
(Name "and")
|
|
||||||
(BinOp (Iden (Name "o_orderkey")) (Name "=")
|
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
|
||||||
(Iden (Name "l_orderkey")))))
|
|
||||||
(Name "and")
|
|
||||||
(BinOp (Iden (Name "o_orderstatus")) (Name "=") (StringLit "F")))
|
|
||||||
(Name "and")
|
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l1")) (Name ".") (Iden (Name "l_receiptdate")))
|
(Iden [ Name Nothing "s_suppkey" ])
|
||||||
(Name ">")
|
[ Name Nothing "=" ]
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
(Iden [ Name Nothing "l1" , Name Nothing "l_suppkey" ]))
|
||||||
(Iden (Name "l_commitdate")))))
|
[ Name Nothing "and" ]
|
||||||
(Name "and")
|
(BinOp
|
||||||
(SubQueryExpr SqExists
|
(Iden [ Name Nothing "o_orderkey" ])
|
||||||
(Select{qeSetQuantifier = All, qeSelectList = [(Star, Nothing)],
|
[ Name Nothing "=" ]
|
||||||
qeFrom =
|
(Iden [ Name Nothing "l1" , Name Nothing "l_orderkey" ])))
|
||||||
[TRAlias (TRSimple (Name "lineitem"))
|
[ Name Nothing "and" ]
|
||||||
(Alias (Name "l2") Nothing)],
|
(BinOp
|
||||||
qeWhere =
|
(Iden [ Name Nothing "o_orderstatus" ])
|
||||||
|
[ Name Nothing "=" ]
|
||||||
|
(StringLit "'" "'" "F")))
|
||||||
|
[ Name Nothing "and" ]
|
||||||
|
(BinOp
|
||||||
|
(Iden [ Name Nothing "l1" , Name Nothing "l_receiptdate" ])
|
||||||
|
[ Name Nothing ">" ]
|
||||||
|
(Iden [ Name Nothing "l1" , Name Nothing "l_commitdate" ])))
|
||||||
|
[ Name Nothing "and" ]
|
||||||
|
(SubQueryExpr
|
||||||
|
SqExists
|
||||||
|
Select
|
||||||
|
{ qeSetQuantifier = SQDefault
|
||||||
|
, qeSelectList = [ ( Star , Nothing ) ]
|
||||||
|
, qeFrom =
|
||||||
|
[ TRAlias
|
||||||
|
(TRSimple [ Name Nothing "lineitem" ])
|
||||||
|
(Alias (Name Nothing "l2") Nothing)
|
||||||
|
]
|
||||||
|
, qeWhere =
|
||||||
Just
|
Just
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l2")) (Name ".")
|
(Iden [ Name Nothing "l2" , Name Nothing "l_orderkey" ])
|
||||||
(Iden (Name "l_orderkey")))
|
[ Name Nothing "=" ]
|
||||||
(Name "=")
|
(Iden [ Name Nothing "l1" , Name Nothing "l_orderkey" ]))
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
[ Name Nothing "and" ]
|
||||||
(Iden (Name "l_orderkey"))))
|
|
||||||
(Name "and")
|
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l2")) (Name ".")
|
(Iden [ Name Nothing "l2" , Name Nothing "l_suppkey" ])
|
||||||
(Iden (Name "l_suppkey")))
|
[ Name Nothing "<>" ]
|
||||||
(Name "<>")
|
(Iden [ Name Nothing "l1" , Name Nothing "l_suppkey" ])))
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
, qeGroupBy = []
|
||||||
(Iden (Name "l_suppkey"))))),
|
, qeHaving = Nothing
|
||||||
qeGroupBy = [], qeHaving = Nothing, qeOrderBy = [],
|
, qeOrderBy = []
|
||||||
qeOffset = Nothing, qeFetchFirst = Nothing})))
|
, qeOffset = Nothing
|
||||||
(Name "and")
|
, qeFetchFirst = Nothing
|
||||||
(PrefixOp (Name "not")
|
}))
|
||||||
(SubQueryExpr SqExists
|
[ Name Nothing "and" ]
|
||||||
(Select{qeSetQuantifier = All, qeSelectList = [(Star, Nothing)],
|
(PrefixOp
|
||||||
qeFrom =
|
[ Name Nothing "not" ]
|
||||||
[TRAlias (TRSimple (Name "lineitem"))
|
(SubQueryExpr
|
||||||
(Alias (Name "l3") Nothing)],
|
SqExists
|
||||||
qeWhere =
|
Select
|
||||||
|
{ qeSetQuantifier = SQDefault
|
||||||
|
, qeSelectList = [ ( Star , Nothing ) ]
|
||||||
|
, qeFrom =
|
||||||
|
[ TRAlias
|
||||||
|
(TRSimple [ Name Nothing "lineitem" ])
|
||||||
|
(Alias (Name Nothing "l3") Nothing)
|
||||||
|
]
|
||||||
|
, qeWhere =
|
||||||
Just
|
Just
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l3")) (Name ".")
|
(Iden [ Name Nothing "l3" , Name Nothing "l_orderkey" ])
|
||||||
(Iden (Name "l_orderkey")))
|
[ Name Nothing "=" ]
|
||||||
(Name "=")
|
(Iden
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
[ Name Nothing "l1" , Name Nothing "l_orderkey" ]))
|
||||||
(Iden (Name "l_orderkey"))))
|
[ Name Nothing "and" ]
|
||||||
(Name "and")
|
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l3")) (Name ".")
|
(Iden [ Name Nothing "l3" , Name Nothing "l_suppkey" ])
|
||||||
(Iden (Name "l_suppkey")))
|
[ Name Nothing "<>" ]
|
||||||
(Name "<>")
|
(Iden
|
||||||
(BinOp (Iden (Name "l1")) (Name ".")
|
[ Name Nothing "l1" , Name Nothing "l_suppkey" ])))
|
||||||
(Iden (Name "l_suppkey")))))
|
[ Name Nothing "and" ]
|
||||||
(Name "and")
|
|
||||||
(BinOp
|
(BinOp
|
||||||
(BinOp (Iden (Name "l3")) (Name ".")
|
(Iden [ Name Nothing "l3" , Name Nothing "l_receiptdate" ])
|
||||||
(Iden (Name "l_receiptdate")))
|
[ Name Nothing ">" ]
|
||||||
(Name ">")
|
(Iden
|
||||||
(BinOp (Iden (Name "l3")) (Name ".")
|
[ Name Nothing "l3" , Name Nothing "l_commitdate" ])))
|
||||||
(Iden (Name "l_commitdate"))))),
|
, qeGroupBy = []
|
||||||
qeGroupBy = [], qeHaving = Nothing, qeOrderBy = [],
|
, qeHaving = Nothing
|
||||||
qeOffset = Nothing, qeFetchFirst = Nothing}))))
|
, qeOrderBy = []
|
||||||
(Name "and")
|
, qeOffset = Nothing
|
||||||
(BinOp (Iden (Name "s_nationkey")) (Name "=")
|
, qeFetchFirst = Nothing
|
||||||
(Iden (Name "n_nationkey"))))
|
})))
|
||||||
(Name "and")
|
[ Name Nothing "and" ]
|
||||||
(BinOp (Iden (Name "n_name")) (Name "=") (StringLit "INDIA"))),
|
(BinOp
|
||||||
qeGroupBy = [SimpleGroup (Iden (Name "s_name"))],
|
(Iden [ Name Nothing "s_nationkey" ])
|
||||||
qeHaving = Nothing,
|
[ Name Nothing "=" ]
|
||||||
qeOrderBy =
|
(Iden [ Name Nothing "n_nationkey" ])))
|
||||||
[SortSpec (Iden (Name "numwait")) Desc NullsOrderDefault,
|
[ Name Nothing "and" ]
|
||||||
SortSpec (Iden (Name "s_name")) Asc NullsOrderDefault],
|
(BinOp
|
||||||
qeOffset = Nothing, qeFetchFirst = Just (NumLit "100")})
|
(Iden [ Name Nothing "n_name" ])
|
||||||
|
[ Name Nothing "=" ]
|
||||||
|
(StringLit "'" "'" "INDIA")))
|
||||||
|
, qeGroupBy = [ SimpleGroup (Iden [ Name Nothing "s_name" ]) ]
|
||||||
|
, qeHaving = Nothing
|
||||||
|
, qeOrderBy =
|
||||||
|
[ SortSpec (Iden [ Name Nothing "numwait" ]) Desc NullsOrderDefault
|
||||||
|
, SortSpec
|
||||||
|
(Iden [ Name Nothing "s_name" ]) DirDefault NullsOrderDefault
|
||||||
|
]
|
||||||
|
, qeOffset = Nothing
|
||||||
|
, qeFetchFirst = Just (NumLit "100")
|
||||||
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,7 +336,7 @@ Parsing some SQL and printing the AST:
|
||||||
|
|
||||||
[source,haskell]
|
[source,haskell]
|
||||||
----
|
----
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import Text.Show.Pretty
|
import Text.Show.Pretty
|
||||||
import System.IO
|
import System.IO
|
||||||
|
@ -298,10 +344,11 @@ import System.IO
|
||||||
import Language.SQL.SimpleSQL.Parse
|
import Language.SQL.SimpleSQL.Parse
|
||||||
(parseStatements
|
(parseStatements
|
||||||
,ParseError
|
,ParseError
|
||||||
,peFormattedError)
|
,prettyError
|
||||||
|
,ansi2011)
|
||||||
import Language.SQL.SimpleSQL.Syntax (ansi2011, Statement)
|
|
||||||
|
|
||||||
|
import Language.SQL.SimpleSQL.Syntax (Statement)
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
@ -331,8 +378,8 @@ main = do
|
||||||
doIt :: String -> IO ()
|
doIt :: String -> IO ()
|
||||||
doIt src = do
|
doIt src = do
|
||||||
let parsed :: Either ParseError [Statement]
|
let parsed :: Either ParseError [Statement]
|
||||||
parsed = parseStatements ansi2011 "" Nothing src
|
parsed = parseStatements ansi2011 "" Nothing (T.pack src)
|
||||||
either (error . peFormattedError)
|
either (error . T.unpack . prettyError)
|
||||||
(putStrLn . ppShow)
|
(putStrLn . ppShow)
|
||||||
parsed
|
parsed
|
||||||
----
|
----
|
||||||
|
|
Loading…
Reference in a new issue