@@ -5,6 +5,7 @@ use prelude::*;
55use query_builder:: * ;
66use result:: QueryResult ;
77use super :: QuerySource ;
8+ use types:: Bool ;
89use util:: TupleAppend ;
910
1011#[ derive( Debug , Clone , Copy ) ]
@@ -47,7 +48,7 @@ impl_query_id!(Join<Left, Right, Kind>);
4748impl_query_id ! ( JoinOn <Join , On >) ;
4849
4950impl < Left , Right > QuerySource for Join < Left , Right , Inner > where
50- Left : QuerySource + JoinTo < Right > + AppendSelection < Right :: DefaultSelection > ,
51+ Left : QuerySource + AppendSelection < Right :: DefaultSelection > ,
5152 Right : QuerySource ,
5253 Left :: Output : SelectableExpression < Self > ,
5354 Self : Clone ,
@@ -65,7 +66,7 @@ impl<Left, Right> QuerySource for Join<Left, Right, Inner> where
6566}
6667
6768impl < Left , Right > QuerySource for Join < Left , Right , LeftOuter > where
68- Left : QuerySource + JoinTo < Right > + AppendSelection < Nullable < Right :: DefaultSelection > > ,
69+ Left : QuerySource + AppendSelection < Nullable < Right :: DefaultSelection > > ,
6970 Right : QuerySource ,
7071 Left :: Output : SelectableExpression < Self > ,
7172 Self : Clone ,
@@ -84,7 +85,7 @@ impl<Left, Right> QuerySource for Join<Left, Right, LeftOuter> where
8485
8586impl < Join , On > QuerySource for JoinOn < Join , On > where
8687 Join : QuerySource ,
87- On : AppearsOnTable < Join :: FromClause > + Clone ,
88+ On : AppearsOnTable < Join :: FromClause , SqlType = Bool > + Clone ,
8889 Join :: DefaultSelection : SelectableExpression < Self > ,
8990{
9091 type FromClause = Grouped < nodes:: InfixNode < ' static , Join :: FromClause , On > > ;
@@ -294,3 +295,27 @@ impl<T, U> Plus<T> for Succ<U> where
294295impl < T > Plus < T > for Never {
295296 type Output = T ;
296297}
298+
299+ #[ doc( hidden) ]
300+ #[ derive( Debug , Clone , Copy ) ]
301+ pub struct OnClauseWrapper < Source , On > {
302+ source : Source ,
303+ on : On ,
304+ }
305+
306+ impl < Source , On > OnClauseWrapper < Source , On > {
307+ pub fn new ( source : Source , on : On ) -> Self {
308+ OnClauseWrapper { source, on }
309+ }
310+ }
311+
312+ impl < Lhs , Rhs , On > JoinTo < OnClauseWrapper < Rhs , On > > for Lhs where
313+ Lhs : Table ,
314+ {
315+ type FromClause = Rhs ;
316+ type OnClause = On ;
317+
318+ fn join_target ( rhs : OnClauseWrapper < Rhs , On > ) -> ( Self :: FromClause , Self :: OnClause ) {
319+ ( rhs. source , rhs. on )
320+ }
321+ }
0 commit comments