2014-06-27 11:19:15 +02:00
|
|
|
|
|
|
|
Tests for mysql dialect parsing
|
|
|
|
|
|
|
|
> module Language.SQL.SimpleSQL.MySQL (mySQLTests) where
|
|
|
|
|
|
|
|
> import Language.SQL.SimpleSQL.TestTypes
|
|
|
|
> import Language.SQL.SimpleSQL.Syntax
|
|
|
|
|
|
|
|
> mySQLTests :: TestItem
|
|
|
|
> mySQLTests = Group "mysql dialect"
|
|
|
|
> [backtickQuotes
|
|
|
|
> ,limit]
|
|
|
|
|
|
|
|
backtick quotes
|
|
|
|
|
|
|
|
limit syntax
|
|
|
|
|
|
|
|
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
|
|
|
|
|
|
|
|
> backtickQuotes :: TestItem
|
2016-02-12 11:51:06 +01:00
|
|
|
> backtickQuotes = Group "backtickQuotes" (map (uncurry (TestValueExpr mysql))
|
2014-06-27 11:19:15 +02:00
|
|
|
> [("`test`", Iden [DQName "`" "`" "test"])
|
|
|
|
> ]
|
2016-02-12 11:51:06 +01:00
|
|
|
> ++ [ParseValueExprFails ansi2011 "`test`"]
|
2014-06-28 14:41:11 +02:00
|
|
|
> )
|
2014-06-27 11:19:15 +02:00
|
|
|
|
|
|
|
> limit :: TestItem
|
2016-02-12 11:51:06 +01:00
|
|
|
> limit = Group "queries" ( map (uncurry (TestQueryExpr mysql))
|
2014-06-27 11:19:15 +02:00
|
|
|
> [("select * from t limit 5"
|
|
|
|
> ,sel {qeFetchFirst = Just (NumLit "5")}
|
|
|
|
> )
|
|
|
|
> ]
|
2016-02-12 11:51:06 +01:00
|
|
|
> ++ [ParseQueryExprFails mysql "select a from t fetch next 10 rows only;"
|
|
|
|
> ,ParseQueryExprFails ansi2011 "select * from t limit 5"]
|
2014-06-28 14:41:11 +02:00
|
|
|
> )
|
2014-06-27 11:19:15 +02:00
|
|
|
> where
|
|
|
|
> sel = makeSelect
|
|
|
|
> {qeSelectList = [(Star, Nothing)]
|
|
|
|
> ,qeFrom = [TRSimple [Name "t"]]
|
|
|
|
> }
|