diff --git a/Language/SQL/SimpleSQL/Parse.lhs b/Language/SQL/SimpleSQL/Parse.lhs index 6e2b62f..87461c3 100644 --- a/Language/SQL/SimpleSQL/Parse.lhs +++ b/Language/SQL/SimpleSQL/Parse.lhs @@ -1523,7 +1523,7 @@ be in the public syntax? > <*> option SQDefault duplicates > <*> corr > where -> cq o d c q0 q1 = CombineQueryExpr q0 o d c q1 +> cq o d c q0 q1 = QueryExprSetOp q0 o d c q1 > setOpK = choice [Union <$ keyword_ "union" > ,Intersect <$ keyword_ "intersect" > ,Except <$ keyword_ "except"] diff --git a/Language/SQL/SimpleSQL/Pretty.lhs b/Language/SQL/SimpleSQL/Pretty.lhs index 0e2444d..c72466f 100644 --- a/Language/SQL/SimpleSQL/Pretty.lhs +++ b/Language/SQL/SimpleSQL/Pretty.lhs @@ -333,7 +333,7 @@ which have been changed to try to improve the layout of the output. > else text "fetch first" <+> scalarExpr dia e > <+> text "rows only") fe -> queryExpr dia (CombineQueryExpr q1 ct d c q2) = +> queryExpr dia (QueryExprSetOp q1 ct d c q2) = > sep [queryExpr dia q1 > ,text (case ct of > Union -> "union" diff --git a/Language/SQL/SimpleSQL/Syntax.lhs b/Language/SQL/SimpleSQL/Syntax.lhs index 4c97d0f..ce4bc37 100644 --- a/Language/SQL/SimpleSQL/Syntax.lhs +++ b/Language/SQL/SimpleSQL/Syntax.lhs @@ -23,7 +23,7 @@ > -- * Query expressions > ,QueryExpr(..) > ,makeSelect -> ,CombineOp(..) +> ,SetOperatorName(..) > ,Corresponding(..) > ,Alias(..) > ,GroupingExpr(..) @@ -211,7 +211,7 @@ in other places > -- | Escape ScalarExpr Char > -- | UEscape ScalarExpr Char > | Collate ScalarExpr [Name] -> | MultisetBinOp ScalarExpr CombineOp SetQuantifier ScalarExpr +> | MultisetBinOp ScalarExpr SetOperatorName SetQuantifier ScalarExpr > | MultisetCtor [ScalarExpr] > | MultisetQueryCtor QueryExpr > | NextValueFor [Name] @@ -349,9 +349,9 @@ This would make some things a bit cleaner? > ,qeOffset :: Maybe ScalarExpr > ,qeFetchFirst :: Maybe ScalarExpr > } -> | CombineQueryExpr +> | QueryExprSetOp > {qe0 :: QueryExpr -> ,qeCombOp :: CombineOp +> ,qeCombOp :: SetOperatorName > ,qeSetQuantifier :: SetQuantifier > ,qeCorresponding :: Corresponding > ,qe1 :: QueryExpr @@ -402,7 +402,7 @@ I'm not sure if this is valid syntax or not. > -- | The direction for a column in order by. > data Direction = DirDefault | Asc | Desc deriving (Eq,Show,Read,Data,Typeable) > -- | Query expression set operators. -> data CombineOp = Union | Except | Intersect deriving (Eq,Show,Read,Data,Typeable) +> data SetOperatorName = Union | Except | Intersect deriving (Eq,Show,Read,Data,Typeable) > -- | Corresponding, an option for the set operators. > data Corresponding = Corresponding | Respectively deriving (Eq,Show,Read,Data,Typeable) diff --git a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs index 99b2d16..2f947d9 100644 --- a/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs +++ b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs @@ -144,24 +144,24 @@ These are a few misc tests which don't fit anywhere else. > combos :: TestItem > combos = Group "combos" $ map (uncurry (TestQueryExpr ansi2011)) > [("select a from t union select b from u" -> ,CombineQueryExpr ms1 Union SQDefault Respectively ms2) +> ,QueryExprSetOp ms1 Union SQDefault Respectively ms2) > ,("select a from t intersect select b from u" -> ,CombineQueryExpr ms1 Intersect SQDefault Respectively ms2) +> ,QueryExprSetOp ms1 Intersect SQDefault Respectively ms2) > ,("select a from t except all select b from u" -> ,CombineQueryExpr ms1 Except All Respectively ms2) +> ,QueryExprSetOp ms1 Except All Respectively ms2) > ,("select a from t union distinct corresponding \ > \select b from u" -> ,CombineQueryExpr ms1 Union Distinct Corresponding ms2) +> ,QueryExprSetOp ms1 Union Distinct Corresponding ms2) > ,("select a from t union select a from t union select a from t" > -- TODO: union should be left associative. I think the others also > -- so this needs to be fixed (new optionSuffix variation which > -- handles this) -> ,CombineQueryExpr ms1 Union SQDefault Respectively -> (CombineQueryExpr ms1 Union SQDefault Respectively ms1)) +> ,QueryExprSetOp ms1 Union SQDefault Respectively +> (QueryExprSetOp ms1 Union SQDefault Respectively ms1)) > ] > where > ms1 = makeSelect