@@ -123,17 +123,22 @@ trait DbApi extends AutoCloseable {
123
123
124
124
object DbApi {
125
125
126
- def unpackQueryable [R , Q ](query : Q , qr : Queryable [Q , R ], config : Config ) = {
127
- val ctx = Context .Impl (Map (), Map (), config)
126
+ def unpackQueryable [R , Q ](
127
+ query : Q ,
128
+ qr : Queryable [Q , R ],
129
+ config : Config ,
130
+ dialectConfig : DialectConfig
131
+ ) = {
132
+ val ctx = Context .Impl (Map (), Map (), config, dialectConfig)
128
133
val flattened = SqlStr .flatten(qr.renderSql(query, ctx))
129
134
flattened
130
135
}
131
136
132
- def renderSql [Q , R ](query : Q , config : Config , castParams : Boolean = false )(
137
+ def renderSql [Q , R ](query : Q , config : Config , dialectConfig : DialectConfig )(
133
138
implicit qr : Queryable [Q , R ]
134
139
): String = {
135
- val flattened = unpackQueryable(query, qr, config)
136
- flattened.renderSql(castParams)
140
+ val flattened = unpackQueryable(query, qr, config, dialectConfig )
141
+ flattened.renderSql(dialectConfig. castParams)
137
142
}
138
143
139
144
/**
@@ -196,7 +201,7 @@ object DbApi {
196
201
lineNum : sourcecode.Line
197
202
): R = {
198
203
199
- val flattened = unpackQueryable(query, qr, config)
204
+ val flattened = unpackQueryable(query, qr, config, dialect )
200
205
if (qr.isGetGeneratedKeys(query).nonEmpty)
201
206
updateGetGeneratedKeysSql(flattened)(qr.isGetGeneratedKeys(query).get, fileName, lineNum)
202
207
.asInstanceOf [R ]
@@ -225,7 +230,7 @@ object DbApi {
225
230
fileName : sourcecode.FileName ,
226
231
lineNum : sourcecode.Line
227
232
): Generator [R ] = {
228
- val flattened = unpackQueryable(query, qr, config)
233
+ val flattened = unpackQueryable(query, qr, config, dialect )
229
234
streamFlattened0(
230
235
r => {
231
236
qr.asInstanceOf [Queryable [Q , R ]].construct(query, r) match {
@@ -276,7 +281,7 @@ object DbApi {
276
281
): Int = {
277
282
val flattened = SqlStr .flatten(sql)
278
283
runRawUpdate0(
279
- flattened.renderSql(DialectConfig .castParams(dialect) ),
284
+ flattened.renderSql(dialect .castParams),
280
285
flattenParamPuts(flattened),
281
286
fetchSize,
282
287
queryTimeoutSeconds,
@@ -296,7 +301,7 @@ object DbApi {
296
301
): IndexedSeq [R ] = {
297
302
val flattened = SqlStr .flatten(sql)
298
303
runRawUpdateGetGeneratedKeys0(
299
- flattened.renderSql(DialectConfig .castParams(dialect) ),
304
+ flattened.renderSql(dialect .castParams),
300
305
flattenParamPuts(flattened),
301
306
fetchSize,
302
307
queryTimeoutSeconds,
@@ -382,7 +387,7 @@ object DbApi {
382
387
lineNum : sourcecode.Line
383
388
) = streamRaw0(
384
389
construct,
385
- flattened.renderSql(DialectConfig .castParams(dialect) ),
390
+ flattened.renderSql(dialect .castParams),
386
391
flattenParamPuts(flattened),
387
392
fetchSize,
388
393
queryTimeoutSeconds,
@@ -508,7 +513,7 @@ object DbApi {
508
513
def renderSql [Q , R ](query : Q , castParams : Boolean = false )(
509
514
implicit qr : Queryable [Q , R ]
510
515
): String = {
511
- DbApi .renderSql(query, config, castParams)
516
+ DbApi .renderSql(query, config, dialect.withCastParams( castParams) )
512
517
}
513
518
514
519
val savepointStack = collection.mutable.ArrayDeque .empty[java.sql.Savepoint ]
0 commit comments