@@ -64,16 +64,19 @@ abstract class KotlinBaseBuilder<D : AbstractWhereStarter<*,*>> {
6464@Suppress(" TooManyFunctions" )
6565abstract class KotlinBaseJoiningBuilder <D : AbstractQueryExpressionDSL <* , * >> : KotlinBaseBuilder <D >() {
6666
67+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
6768 fun join (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
6869 applyToDsl(joinCriteria) { jc ->
6970 join(table, jc.initialCriterion(), jc.subCriteria())
7071 }
7172
73+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
7274 fun join (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
7375 applyToDsl(joinCriteria) { jc ->
7476 join(table, alias, jc.initialCriterion(), jc.subCriteria())
7577 }
7678
79+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
7780 fun join (
7881 subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
7982 joinCriteria : JoinReceiver
@@ -82,16 +85,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
8285 join(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
8386 }
8487
88+ fun join (table : SqlTable ): JoinCriteriaGatherer =
89+ JoinCriteriaGatherer {
90+ getDsl().join(table, it.initialCriterion, it.subCriteria)
91+ }
92+
93+ fun join (table : SqlTable , alias : String ): JoinCriteriaGatherer =
94+ JoinCriteriaGatherer {
95+ getDsl().join(table, alias, it.initialCriterion, it.subCriteria)
96+ }
97+
98+ fun join (
99+ subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ): JoinCriteriaGatherer =
100+ JoinCriteriaGatherer {
101+ val sq = KotlinQualifiedSubQueryBuilder ().apply (subQuery)
102+ getDsl().join(sq, sq.correlationName, it.initialCriterion, it.subCriteria)
103+ }
104+
105+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
85106 fun fullJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
86107 applyToDsl(joinCriteria) { jc ->
87108 fullJoin(table, jc.initialCriterion(), jc.subCriteria())
88109 }
89110
111+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
90112 fun fullJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
91113 applyToDsl(joinCriteria) { jc ->
92114 fullJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
93115 }
94116
117+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
95118 fun fullJoin (
96119 subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
97120 joinCriteria : JoinReceiver
@@ -100,16 +123,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
100123 fullJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
101124 }
102125
126+ fun fullJoin (table : SqlTable ): JoinCriteriaGatherer =
127+ JoinCriteriaGatherer {
128+ getDsl().fullJoin(table, it.initialCriterion, it.subCriteria)
129+ }
130+
131+ fun fullJoin (table : SqlTable , alias : String ): JoinCriteriaGatherer =
132+ JoinCriteriaGatherer {
133+ getDsl().fullJoin(table, alias, it.initialCriterion, it.subCriteria)
134+ }
135+
136+ fun fullJoin (
137+ subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ): JoinCriteriaGatherer =
138+ JoinCriteriaGatherer {
139+ val sq = KotlinQualifiedSubQueryBuilder ().apply (subQuery)
140+ getDsl().fullJoin(sq, sq.correlationName, it.initialCriterion, it.subCriteria)
141+ }
142+
143+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
103144 fun leftJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
104145 applyToDsl(joinCriteria) { jc ->
105146 leftJoin(table, jc.initialCriterion(), jc.subCriteria())
106147 }
107148
149+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
108150 fun leftJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
109151 applyToDsl(joinCriteria) { jc ->
110152 leftJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
111153 }
112154
155+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
113156 fun leftJoin (
114157 subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
115158 joinCriteria : JoinReceiver
@@ -118,16 +161,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
118161 leftJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
119162 }
120163
164+ fun leftJoin (table : SqlTable ): JoinCriteriaGatherer =
165+ JoinCriteriaGatherer {
166+ getDsl().leftJoin(table, it.initialCriterion, it.subCriteria)
167+ }
168+
169+ fun leftJoin (table : SqlTable , alias : String ): JoinCriteriaGatherer =
170+ JoinCriteriaGatherer {
171+ getDsl().leftJoin(table, alias, it.initialCriterion, it.subCriteria)
172+ }
173+
174+ fun leftJoin (
175+ subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ): JoinCriteriaGatherer =
176+ JoinCriteriaGatherer {
177+ val sq = KotlinQualifiedSubQueryBuilder ().apply (subQuery)
178+ getDsl().leftJoin(sq, sq.correlationName, it.initialCriterion, it.subCriteria)
179+ }
180+
181+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
121182 fun rightJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
122183 applyToDsl(joinCriteria) { jc ->
123184 rightJoin(table, jc.initialCriterion(), jc.subCriteria())
124185 }
125186
187+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
126188 fun rightJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
127189 applyToDsl(joinCriteria) { jc ->
128190 rightJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
129191 }
130192
193+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
131194 fun rightJoin (
132195 subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
133196 joinCriteria : JoinReceiver
@@ -136,6 +199,23 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
136199 rightJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
137200 }
138201
202+ fun rightJoin (table : SqlTable ): JoinCriteriaGatherer =
203+ JoinCriteriaGatherer {
204+ getDsl().rightJoin(table, it.initialCriterion, it.subCriteria)
205+ }
206+
207+ fun rightJoin (table : SqlTable , alias : String ): JoinCriteriaGatherer =
208+ JoinCriteriaGatherer {
209+ getDsl().rightJoin(table, alias, it.initialCriterion, it.subCriteria)
210+ }
211+
212+ fun rightJoin (
213+ subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ): JoinCriteriaGatherer =
214+ JoinCriteriaGatherer {
215+ val sq = KotlinQualifiedSubQueryBuilder ().apply (subQuery)
216+ getDsl().rightJoin(sq, sq.correlationName, it.initialCriterion, it.subCriteria)
217+ }
218+
139219 private fun applyToDsl (joinCriteria : JoinReceiver , applyJoin : D .(JoinCollector ) -> Unit ) {
140220 getDsl().applyJoin(JoinCollector ().apply (joinCriteria))
141221 }
@@ -148,3 +228,11 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
148228 getDsl().applyJoin(KotlinQualifiedSubQueryBuilder ().apply (subQuery), JoinCollector ().apply (joinCriteria))
149229 }
150230}
231+
232+ class JoinCriteriaGatherer (private val consumer : (GroupingCriteriaCollector ) -> Unit ) {
233+ infix fun on (joinCriteria : GroupingCriteriaReceiver ): Unit =
234+ with (GroupingCriteriaCollector ().apply (joinCriteria)) {
235+ assertTrue(initialCriterion != null || subCriteria.isNotEmpty(), " ERROR.22" ) // $NON-NLS-1$
236+ consumer.invoke(this )
237+ }
238+ }
0 commit comments