remove debug
This commit is contained in:
parent
1ea6e709d2
commit
edc7db8f3f
@ -1,8 +1,15 @@
|
|||||||
|
3.2.2
|
||||||
|
========
|
||||||
|
|
||||||
|
- @parsonsmatt
|
||||||
|
- [#161](https://github.com/bitemyapp/esqueleto/pull/161/): Fix an issue where
|
||||||
|
nested joins didn't get the right on clause.
|
||||||
|
|
||||||
3.2.1
|
3.2.1
|
||||||
========
|
========
|
||||||
|
|
||||||
- @parsonsmatt
|
- @parsonsmatt
|
||||||
= [#159](https://github.com/bitemyapp/esqueleto/pull/159): Add an instance of `UnsafeSqlFunction ()` for 0-argument SQL
|
- [#159](https://github.com/bitemyapp/esqueleto/pull/159): Add an instance of `UnsafeSqlFunction ()` for 0-argument SQL
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
3.2.0
|
3.2.0
|
||||||
|
|||||||
@ -64,7 +64,6 @@ import qualified Data.Text.Lazy.Builder as TLB
|
|||||||
import Data.Typeable (Typeable)
|
import Data.Typeable (Typeable)
|
||||||
import Text.Blaze.Html (Html)
|
import Text.Blaze.Html (Html)
|
||||||
|
|
||||||
import qualified Debug.Trace as Debug
|
|
||||||
import Database.Esqueleto.Internal.ExprParser (TableAccess(..), parseOnExpr)
|
import Database.Esqueleto.Internal.ExprParser (TableAccess(..), parseOnExpr)
|
||||||
|
|
||||||
-- | (Internal) Start a 'from' query with an entity. 'from'
|
-- | (Internal) Start a 'from' query with an entity. 'from'
|
||||||
@ -1579,7 +1578,6 @@ collectOnClauses
|
|||||||
-> [FromClause]
|
-> [FromClause]
|
||||||
-> Either (SqlExpr (Value Bool)) [FromClause]
|
-> Either (SqlExpr (Value Bool)) [FromClause]
|
||||||
collectOnClauses sqlBackend = go Set.empty []
|
collectOnClauses sqlBackend = go Set.empty []
|
||||||
-- . (\fcs -> Debug.trace (mappend "FromClauses: " (show fcs)) fcs)
|
|
||||||
where
|
where
|
||||||
go is [] (f@(FromStart i _) : fs) =
|
go is [] (f@(FromStart i _) : fs) =
|
||||||
fmap (f:) (go (Set.insert i is) [] fs) -- fast path
|
fmap (f:) (go (Set.insert i is) [] fs) -- fast path
|
||||||
@ -1636,45 +1634,33 @@ collectOnClauses sqlBackend = go Set.empty []
|
|||||||
<$> tryMatch idents expr l
|
<$> tryMatch idents expr l
|
||||||
|
|
||||||
matchPartial = do
|
matchPartial = do
|
||||||
-- Debug.traceM $ "matchPartial"
|
|
||||||
-- Debug.traceM $ "matchPartial: identsInOnClause: " <> show identsInOnClause
|
|
||||||
-- Debug.traceM $ "matchPartial: seen idents: " <> show idents
|
|
||||||
ll <- findLeftmostIdent l
|
ll <- findLeftmostIdent l
|
||||||
-- Debug.traceM $ "matchPartial: ll: " <> show ll
|
|
||||||
rr <- findLeftmostIdent r
|
rr <- findLeftmostIdent r
|
||||||
-- Debug.traceM $ "matchPartial: rr: " <> show rr
|
|
||||||
guard $
|
guard $
|
||||||
Set.isSubsetOf
|
Set.isSubsetOf
|
||||||
identsInOnClause
|
identsInOnClause
|
||||||
(Set.fromList [ll, rr])
|
(Set.fromList [ll, rr])
|
||||||
-- Debug.traceM "matchPartial: passed subset check"
|
|
||||||
guard $ k /= CrossJoinKind
|
guard $ k /= CrossJoinKind
|
||||||
-- Debug.traceM "matchPartial: passed cross join kind check"
|
|
||||||
guard $ Maybe.isNothing onClause
|
guard $ Maybe.isNothing onClause
|
||||||
-- Debug.traceM "matchPartial: passed isNothing check!"
|
|
||||||
pure (Set.fromList [] <> idents, FromJoin l k r (Just expr))
|
pure (Set.fromList [] <> idents, FromJoin l k r (Just expr))
|
||||||
|
|
||||||
matchC =
|
matchC =
|
||||||
case onClause of
|
case onClause of
|
||||||
Nothing
|
Nothing
|
||||||
| "?" `T.isInfixOf` renderedExpr ->
|
| "?" `T.isInfixOf` renderedExpr ->
|
||||||
-- Debug.trace ("matchC success" <> show identsInOnClause) $
|
|
||||||
return (idents, FromJoin l k r (Just expr))
|
return (idents, FromJoin l k r (Just expr))
|
||||||
| Set.null identsInOnClause ->
|
| Set.null identsInOnClause ->
|
||||||
-- Debug.trace ("matchC success" <> show identsInOnClause) $
|
|
||||||
return (idents, FromJoin l k r (Just expr))
|
return (idents, FromJoin l k r (Just expr))
|
||||||
| otherwise ->
|
| otherwise ->
|
||||||
Nothing
|
Nothing
|
||||||
Just _ ->
|
Just _ ->
|
||||||
Nothing
|
Nothing
|
||||||
matchTable = do
|
matchTable = do
|
||||||
-- Debug.traceM $ "matchTable: " <> show identsInOnClause
|
|
||||||
i1 <- findLeftmostIdent r
|
i1 <- findLeftmostIdent r
|
||||||
i2 <- findRightmostIdent l
|
i2 <- findRightmostIdent l
|
||||||
guard $ Set.fromList [i1, i2] `Set.isSubsetOf` identsInOnClause
|
guard $ Set.fromList [i1, i2] `Set.isSubsetOf` identsInOnClause
|
||||||
guard $ k /= CrossJoinKind
|
guard $ k /= CrossJoinKind
|
||||||
guard $ Maybe.isNothing onClause
|
guard $ Maybe.isNothing onClause
|
||||||
-- Debug.traceM $ "matchTable: succeed " <> show identsInOnClause
|
|
||||||
pure (Set.fromList [i1, i2] <> idents, FromJoin l k r (Just expr))
|
pure (Set.fromList [i1, i2] <> idents, FromJoin l k r (Just expr))
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user