@@ -64,16 +64,19 @@ abstract class KotlinBaseBuilder<D : AbstractWhereStarter<*,*>> {
64
64
@Suppress(" TooManyFunctions" )
65
65
abstract class KotlinBaseJoiningBuilder <D : AbstractQueryExpressionDSL <* , * >> : KotlinBaseBuilder <D >() {
66
66
67
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
67
68
fun join (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
68
69
applyToDsl(joinCriteria) { jc ->
69
70
join(table, jc.initialCriterion(), jc.subCriteria())
70
71
}
71
72
73
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
72
74
fun join (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
73
75
applyToDsl(joinCriteria) { jc ->
74
76
join(table, alias, jc.initialCriterion(), jc.subCriteria())
75
77
}
76
78
79
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
77
80
fun join (
78
81
subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
79
82
joinCriteria : JoinReceiver
@@ -82,16 +85,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
82
85
join(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
83
86
}
84
87
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" )
85
106
fun fullJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
86
107
applyToDsl(joinCriteria) { jc ->
87
108
fullJoin(table, jc.initialCriterion(), jc.subCriteria())
88
109
}
89
110
111
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
90
112
fun fullJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
91
113
applyToDsl(joinCriteria) { jc ->
92
114
fullJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
93
115
}
94
116
117
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
95
118
fun fullJoin (
96
119
subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
97
120
joinCriteria : JoinReceiver
@@ -100,16 +123,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
100
123
fullJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
101
124
}
102
125
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" )
103
144
fun leftJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
104
145
applyToDsl(joinCriteria) { jc ->
105
146
leftJoin(table, jc.initialCriterion(), jc.subCriteria())
106
147
}
107
148
149
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
108
150
fun leftJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
109
151
applyToDsl(joinCriteria) { jc ->
110
152
leftJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
111
153
}
112
154
155
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
113
156
fun leftJoin (
114
157
subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
115
158
joinCriteria : JoinReceiver
@@ -118,16 +161,36 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
118
161
leftJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
119
162
}
120
163
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" )
121
182
fun rightJoin (table : SqlTable , joinCriteria : JoinReceiver ): Unit =
122
183
applyToDsl(joinCriteria) { jc ->
123
184
rightJoin(table, jc.initialCriterion(), jc.subCriteria())
124
185
}
125
186
187
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
126
188
fun rightJoin (table : SqlTable , alias : String , joinCriteria : JoinReceiver ): Unit =
127
189
applyToDsl(joinCriteria) { jc ->
128
190
rightJoin(table, alias, jc.initialCriterion(), jc.subCriteria())
129
191
}
130
192
193
+ @Deprecated(" Please use the new form with the \" on\" keyword outside the lambda" )
131
194
fun rightJoin (
132
195
subQuery : KotlinQualifiedSubQueryBuilder .() -> Unit ,
133
196
joinCriteria : JoinReceiver
@@ -136,6 +199,23 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
136
199
rightJoin(sq, sq.correlationName, jc.initialCriterion(), jc.subCriteria())
137
200
}
138
201
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
+
139
219
private fun applyToDsl (joinCriteria : JoinReceiver , applyJoin : D .(JoinCollector ) -> Unit ) {
140
220
getDsl().applyJoin(JoinCollector ().apply (joinCriteria))
141
221
}
@@ -148,3 +228,11 @@ abstract class KotlinBaseJoiningBuilder<D : AbstractQueryExpressionDSL<*, *>> :
148
228
getDsl().applyJoin(KotlinQualifiedSubQueryBuilder ().apply (subQuery), JoinCollector ().apply (joinCriteria))
149
229
}
150
230
}
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