1
Fork 0

add support for quoted identifiers

This commit is contained in:
Jake Wheat 2013-12-17 13:21:36 +02:00
parent 045f2be825
commit 4330b3d7e0
12 changed files with 118 additions and 82 deletions

View file

@ -1,6 +1,7 @@
Some tests for parsing full queries.
> {-# LANGUAGE OverloadedStrings #-}
> module Language.SQL.SimpleSQL.FullQueries (fullQueriesTests) where
> import Language.SQL.SimpleSQL.TestTypes

View file

@ -118,7 +118,7 @@ queries section
> ,"SELECT a AS value, b + c AS sum FROM t"
> --,"SELECT a \"value\", b + c AS sum FROM t" -- quoted identifier
> ,"SELECT a \"value\", b + c AS sum FROM t"
> ,"SELECT DISTINCT select_list t"

View file

@ -5,6 +5,7 @@ table refs which are in a separate file.
These are a few misc tests which don't fit anywhere else.
> {-# LANGUAGE OverloadedStrings #-}
> module Language.SQL.SimpleSQL.QueryExprComponents (queryExprComponentTests) where
> import Language.SQL.SimpleSQL.TestTypes

View file

@ -1,6 +1,7 @@
Tests for parsing scalar expressions
> {-# LANGUAGE OverloadedStrings #-}
> module Language.SQL.SimpleSQL.ScalarExprs (scalarExprTests) where
> import Language.SQL.SimpleSQL.TestTypes
@ -43,6 +44,7 @@ Tests for parsing scalar expressions
> identifiers = Group "identifiers" $ map (uncurry TestScalarExpr)
> [("iden1", Iden "iden1")
> ,("t.a", Iden2 "t" "a")
> ,("\"quoted identifier\"", Iden $ QName "quoted identifier")
> ]
> star :: TestItem

View file

@ -2,6 +2,7 @@
These are the tests for parsing focusing on the from part of query
expression
> {-# LANGUAGE OverloadedStrings #-}
> module Language.SQL.SimpleSQL.TableRefs (tableRefTests) where
> import Language.SQL.SimpleSQL.TestTypes

View file

@ -6,6 +6,8 @@ Tests.lhs module for the 'interpreter'.
> import Language.SQL.SimpleSQL.Syntax
> import Data.String
> data TestItem = Group String [TestItem]
> | TestScalarExpr String ScalarExpr
> | TestQueryExpr String QueryExpr
@ -18,3 +20,7 @@ should all be TODO to convert to a testqueryexpr test.
> | ParseQueryExpr String
> deriving (Eq,Show)
hack to make the tests a bit simpler
> instance IsString Name where
> fromString = Name