Fix binding mismatch problem in oneOf queries.
This commit is contained in:
parent
a4b66e00e4
commit
5cb294f33e
|
@ -394,10 +394,9 @@ class InternalBuilder {
|
||||||
(key: string, array) => {
|
(key: string, array) => {
|
||||||
if (this.client === SqlClient.ORACLE) {
|
if (this.client === SqlClient.ORACLE) {
|
||||||
key = convertClobs(this.client, table, key)
|
key = convertClobs(this.client, table, key)
|
||||||
query = query.whereRaw(
|
array = Array.isArray(array) ? array : [array]
|
||||||
`${key} IN (?)`,
|
const binding = new Array(array.length).fill("?").join(",")
|
||||||
Array.isArray(array) ? array : [array]
|
query = query.whereRaw(`${key} IN (${binding})`, array)
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
query = query[fnc](key, Array.isArray(array) ? array : [array])
|
query = query[fnc](key, Array.isArray(array) ? array : [array])
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ export function getNativeSql(
|
||||||
query: Knex.SchemaBuilder | Knex.QueryBuilder
|
query: Knex.SchemaBuilder | Knex.QueryBuilder
|
||||||
): SqlQuery | SqlQuery[] {
|
): SqlQuery | SqlQuery[] {
|
||||||
let sql = query.toSQL()
|
let sql = query.toSQL()
|
||||||
|
|
||||||
if (Array.isArray(sql)) {
|
if (Array.isArray(sql)) {
|
||||||
return sql as SqlQuery[]
|
return sql as SqlQuery[]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue