@@ -128,80 +128,6 @@ abstract class BaseQueryGenerator : BaseGenerator {
128
128
return withStep
129
129
}
130
130
131
- fun mkNativeQueryCTE (
132
- request : QueryRequest
133
- ): org.jooq.WithStep {
134
- val config = ConnectorConfiguration .Loader .config
135
-
136
- fun renderNativeQuerySQL (
137
- nativeQuery : NativeQueryInfo ,
138
- arguments : Map <String , Argument >
139
- ): String {
140
- val sql = nativeQuery.sql
141
- val parts = sql.parts
142
-
143
- return parts.joinToString(" " ) { part ->
144
- when (part) {
145
- is NativeQueryPart .Text -> part.value
146
- is NativeQueryPart .Parameter -> {
147
- val argument = arguments[part.value] ? : error(" Argument ${part.value} not found" )
148
- when (argument) {
149
- is Argument .Literal -> argument.value.toString()
150
- else -> error(" Only literals are supported in Native Queries in this version" )
151
- }
152
- }
153
- }
154
- }
155
- }
156
-
157
- val nativeQuery = config.nativeQueries[request.collection]!!
158
- val nativeQuerySQL = renderNativeQuerySQL(nativeQuery, request.arguments)
159
-
160
- return DSL .with (
161
- DSL .name(request.collection)
162
- ).`as `(
163
- DSL .resultQuery(nativeQuerySQL)
164
- )
165
- }
166
-
167
- // TODO: Fix this being duplicated due to "buildCTEs" in Snowflake CTE Strategy wanting CommonTableExpression<*> instead of WithStep
168
- // Probably easiest to make them both return CommonTableExpression<*> and wrap with DSL.with() in the specific implementations
169
- fun mkNativeQueryCTESnowflake (
170
- request : QueryRequest
171
- ): org.jooq.CommonTableExpression <* > {
172
- val config = ConnectorConfiguration .Loader .config
173
-
174
- fun renderNativeQuerySQL (
175
- nativeQuery : NativeQueryInfo ,
176
- arguments : Map <String , Argument >
177
- ): String {
178
- val sql = nativeQuery.sql
179
- val parts = sql.parts
180
-
181
- return parts.joinToString(" " ) { part ->
182
- when (part) {
183
- is NativeQueryPart .Text -> part.value
184
- is NativeQueryPart .Parameter -> {
185
- val argument = arguments[part.value] ? : error(" Argument ${part.value} not found" )
186
- when (argument) {
187
- is Argument .Literal -> argument.value.toString()
188
- else -> error(" Only literals are supported in Native Queries in this version" )
189
- }
190
- }
191
- }
192
- }
193
- }
194
-
195
- val nativeQuery = config.nativeQueries[request.collection]!!
196
- val nativeQuerySQL = renderNativeQuerySQL(nativeQuery, request.arguments)
197
-
198
- return DSL .name(
199
- request.collection
200
- ).`as `(
201
- DSL .resultQuery(nativeQuerySQL)
202
- )
203
- }
204
-
205
131
fun getQueryColumnFields (fields : Map <String , IRField >): Map <String , IRField .ColumnField > {
206
132
return fields
207
133
.filterValues { it is IRField .ColumnField }
0 commit comments