renames OrderField->SortSpec, InThing->InPredValue
This commit is contained in:
parent
b89f2a011c
commit
b631497a04
8 changed files with 40 additions and 40 deletions
Language/SQL/SimpleSQL
|
@ -121,8 +121,8 @@ the fixity code.
|
|||
> name n = case n of
|
||||
> QName q -> '"' : q
|
||||
> Name m -> m
|
||||
> orderExps = map (toHaskell . (\(OrderField a _ _) -> a))
|
||||
> orderInf = map (\(OrderField _ b c) -> (b,c))
|
||||
> orderExps = map (toHaskell . (\(SortSpec a _ _) -> a))
|
||||
> orderInf = map (\(SortSpec _ b c) -> (b,c))
|
||||
|
||||
|
||||
|
||||
|
@ -171,7 +171,7 @@ the fixity code.
|
|||
> in In b (toSql e0) sq
|
||||
> _ -> err e
|
||||
> where
|
||||
> sord = zipWith (\(i0,i1) ce -> OrderField (toSql ce) i0 i1)
|
||||
> sord = zipWith (\(i0,i1) ce -> SortSpec (toSql ce) i0 i1)
|
||||
> ltom (HSE.List []) = Nothing
|
||||
> ltom (HSE.List [ex]) = Just $ toSql ex
|
||||
> ltom ex = err ex
|
||||
|
|
|
@ -712,10 +712,10 @@ where, having, limit, offset).
|
|||
> having :: P ScalarExpr
|
||||
> having = keywordScalarExpr "having"
|
||||
|
||||
> orderBy :: P [OrderField]
|
||||
> orderBy :: P [SortSpec]
|
||||
> orderBy = try (keyword_ "order") *> keyword_ "by" *> commaSep1 ob
|
||||
> where
|
||||
> ob = OrderField
|
||||
> ob = SortSpec
|
||||
> <$> scalarExpr
|
||||
> <*> option Asc (choice [Asc <$ keyword_ "asc"
|
||||
> ,Desc <$ keyword_ "desc"])
|
||||
|
|
|
@ -266,12 +266,12 @@
|
|||
> ge (Rollup es) = text "rollup" <> parens (commaSep $ map ge es)
|
||||
> ge (GroupingSets es) = text "grouping sets" <> parens (commaSep $ map ge es)
|
||||
|
||||
> orderBy :: [OrderField] -> Doc
|
||||
> orderBy :: [SortSpec] -> Doc
|
||||
> orderBy [] = empty
|
||||
> orderBy os = sep [text "order by"
|
||||
> ,nest 9 $ commaSep $ map f os]
|
||||
> where
|
||||
> f (OrderField e d n) =
|
||||
> f (SortSpec e d n) =
|
||||
> scalarExpr e
|
||||
> <+> (if d == Asc then empty else text "desc")
|
||||
> <+> (case n of
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
> ,Name(..)
|
||||
> ,TypeName(..)
|
||||
> ,Duplicates(..)
|
||||
> ,OrderField(..)
|
||||
> ,SortSpec(..)
|
||||
> ,Direction(..)
|
||||
> ,NullsOrder(..)
|
||||
> ,InThing(..)
|
||||
> ,InPredValue(..)
|
||||
> ,SubQueryExprType(..)
|
||||
> ,Frame(..)
|
||||
> ,FrameRows(..)
|
||||
|
@ -67,7 +67,7 @@
|
|||
> {aggName :: Name -- ^ aggregate function name
|
||||
> ,aggDistinct :: Maybe Duplicates -- ^ distinct
|
||||
> ,aggArgs :: [ScalarExpr]-- ^ args
|
||||
> ,aggOrderBy :: [OrderField] -- ^ order by
|
||||
> ,aggOrderBy :: [SortSpec] -- ^ order by
|
||||
> }
|
||||
> -- | window application, which adds over (partition by a order
|
||||
> -- by b) to regular function application. Explicit frames are
|
||||
|
@ -76,7 +76,7 @@
|
|||
> {wnName :: Name -- ^ window function name
|
||||
> ,wnArgs :: [ScalarExpr] -- ^ args
|
||||
> ,wnPartition :: [ScalarExpr] -- ^ partition by
|
||||
> ,wnOrderBy :: [OrderField] -- ^ order by
|
||||
> ,wnOrderBy :: [SortSpec] -- ^ order by
|
||||
> ,wnFrame :: Maybe Frame -- ^ frame clause
|
||||
> }
|
||||
> -- | Infix binary operators. This is used for symbol operators
|
||||
|
@ -114,7 +114,7 @@
|
|||
> | SubQueryExpr SubQueryExprType QueryExpr
|
||||
> -- | in list literal and in subquery, if the bool is false it
|
||||
> -- means not in was used ('a not in (1,2)')
|
||||
> | In Bool ScalarExpr InThing
|
||||
> | In Bool ScalarExpr InPredValue
|
||||
> deriving (Eq,Show,Read)
|
||||
|
||||
> -- | Represents an identifier name, which can be quoted or unquoted.
|
||||
|
@ -131,9 +131,9 @@
|
|||
|
||||
> -- | Used for 'expr in (scalar expression list)', and 'expr in
|
||||
> -- (subquery)' syntax.
|
||||
> data InThing = InList [ScalarExpr]
|
||||
> | InQueryExpr QueryExpr
|
||||
> deriving (Eq,Show,Read)
|
||||
> data InPredValue = InList [ScalarExpr]
|
||||
> | InQueryExpr QueryExpr
|
||||
> deriving (Eq,Show,Read)
|
||||
|
||||
> -- | A subquery in a scalar expression.
|
||||
> data SubQueryExprType
|
||||
|
@ -150,8 +150,8 @@
|
|||
> deriving (Eq,Show,Read)
|
||||
|
||||
> -- | Represents one field in an order by list.
|
||||
> data OrderField = OrderField ScalarExpr Direction NullsOrder
|
||||
> deriving (Eq,Show,Read)
|
||||
> data SortSpec = SortSpec ScalarExpr Direction NullsOrder
|
||||
> deriving (Eq,Show,Read)
|
||||
|
||||
> -- | Represents 'nulls first' or 'nulls last' in an order by clause.
|
||||
> data NullsOrder = NullsOrderDefault
|
||||
|
@ -199,7 +199,7 @@
|
|||
> ,qeWhere :: Maybe ScalarExpr
|
||||
> ,qeGroupBy :: [GroupingExpr]
|
||||
> ,qeHaving :: Maybe ScalarExpr
|
||||
> ,qeOrderBy :: [OrderField]
|
||||
> ,qeOrderBy :: [SortSpec]
|
||||
> ,qeOffset :: Maybe ScalarExpr
|
||||
> ,qeFetch :: Maybe ScalarExpr
|
||||
> }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue