Disable unsafeMergeAnotherQuery.

This commit is contained in:
Kei Hibino 2013-05-26 03:33:40 +09:00
parent d955047186
commit d5a9b9ed58
4 changed files with 12 additions and 10 deletions

View File

@ -36,7 +36,7 @@ import Database.Relational.Query.Sub (SubQuery)
import Database.Relational.Query.Monad.Class (MonadQuery(on, wheres))
import Database.Relational.Query.Monad.Unsafe
(UnsafeMonadQuery(unsafeSubQuery, unsafeMergeAnotherQuery))
(UnsafeMonadQuery(unsafeSubQuery))
newtype QueryCore a =
QueryCore { queryState :: State Context a }
@ -113,7 +113,7 @@ unsafeQueryMergeWithAttr = unsafeMergeAnother
instance UnsafeMonadQuery QueryCore where
unsafeSubQuery = unsafeSubQueryWithAttr
unsafeMergeAnotherQuery = unsafeQueryMergeWithAttr
-- unsafeMergeAnotherQuery = unsafeQueryMergeWithAttr
expandSQL :: QueryCore (Projection r, st) -> ((String, Projection r), st)
expandSQL qp = ((composeSQL pj c, pj), st) where

View File

@ -3,7 +3,7 @@
module Database.Relational.Query.Monad.Ordering (
Orderings, orderings, OrderedQuery,
unsafeMergeAnotherOrderBys,
-- unsafeMergeAnotherOrderBys,
asc, desc,
@ -19,13 +19,13 @@ import Control.Arrow (second)
import Database.Relational.Query.Internal.Context
(Order(Asc, Desc), OrderBys, OrderingContext, primeOrderingContext)
import qualified Database.Relational.Query.Internal.Context as Context
import Database.Relational.Query.Internal.Product (NodeAttr)
-- import Database.Relational.Query.Internal.Product (NodeAttr)
import Database.Relational.Query.Projection (Projection)
import qualified Database.Relational.Query.Projection as Projection
import Database.Relational.Query.Monad.Class (MonadQuery(on, wheres))
import Database.Relational.Query.Monad.Unsafe (UnsafeMonadQuery(unsafeSubQuery, unsafeMergeAnotherQuery))
import Database.Relational.Query.Monad.Unsafe (UnsafeMonadQuery(unsafeSubQuery))
newtype Orderings (p :: * -> *) m a =
Orderings { orderingState :: StateT OrderingContext m a }
@ -78,6 +78,7 @@ takeOrderBys = Orderings $ state Context.takeOrderBys
restoreLowOrderBys :: Monad m => Context.OrderBys -> Orderings p m ()
restoreLowOrderBys ros = updateOrderingContext $ Context.restoreLowOrderBys ros
{-
unsafeMergeAnotherOrderBys :: UnsafeMonadQuery m
=> NodeAttr
-> Orderings p m (Projection r)
@ -88,10 +89,11 @@ unsafeMergeAnotherOrderBys naR qR = do
v <- lift $ unsafeMergeAnotherQuery naR qR'
restoreLowOrderBys ros
return v
-}
instance UnsafeMonadQuery m => UnsafeMonadQuery (Orderings p m) where
unsafeSubQuery na = orderings . unsafeSubQuery na
unsafeMergeAnotherQuery = unsafeMergeAnotherOrderBys
-- unsafeMergeAnotherQuery = unsafeMergeAnotherOrderBys
asc :: (Monad m, OrderingTerms p) => p t -> Orderings p m ()

View File

@ -5,7 +5,7 @@ module Database.Relational.Query.Monad.Simple (
simple,
unsafeMergeAnotherOrderBys,
-- unsafeMergeAnotherOrderBys,
toSQL,
toSubQuery
@ -30,8 +30,8 @@ type SimpleQuery r = OrderedQuery Projection QueryCore r
simple :: QueryCore a -> QuerySimple a
simple = orderings
unsafeMergeAnotherOrderBys :: NodeAttr -> QuerySimple (Projection r) -> QuerySimple (Projection r)
unsafeMergeAnotherOrderBys = Ordering.unsafeMergeAnotherOrderBys
-- unsafeMergeAnotherOrderBys :: NodeAttr -> QuerySimple (Projection r) -> QuerySimple (Projection r)
-- unsafeMergeAnotherOrderBys = Ordering.unsafeMergeAnotherOrderBys
toSQL :: SimpleQuery r -> String
toSQL q = append sql where

View File

@ -9,4 +9,4 @@ import Database.Relational.Query.Sub (SubQuery)
class (Functor m, Monad m) => UnsafeMonadQuery m where
unsafeSubQuery :: NodeAttr -> SubQuery -> m (Projection t)
unsafeMergeAnotherQuery :: NodeAttr -> m (Projection r) -> m (Projection r)
-- unsafeMergeAnotherQuery :: NodeAttr -> m (Projection r) -> m (Projection r)