fix tests
This commit is contained in:
parent
c69e604eaf
commit
d610317ef5
|
@ -1162,31 +1162,32 @@ class InternalBuilder {
|
||||||
const direction =
|
const direction =
|
||||||
value.direction === SortOrder.ASCENDING ? "asc" : "desc"
|
value.direction === SortOrder.ASCENDING ? "asc" : "desc"
|
||||||
|
|
||||||
let nulls: "first" | "last" =
|
// TODO: figure out a way to remove this conditional, not relying on
|
||||||
value.direction === SortOrder.ASCENDING ? "first" : "last"
|
// the defaults of each datastore.
|
||||||
|
let nulls: "first" | "last" | undefined = undefined
|
||||||
|
if (
|
||||||
|
this.client === SqlClient.POSTGRES ||
|
||||||
|
this.client === SqlClient.ORACLE
|
||||||
|
) {
|
||||||
|
nulls = value.direction === SortOrder.ASCENDING ? "first" : "last"
|
||||||
|
}
|
||||||
|
|
||||||
|
const composite = `${aliased}.${key}`
|
||||||
|
let identifier
|
||||||
|
|
||||||
if (this.isAggregateField(key)) {
|
if (this.isAggregateField(key)) {
|
||||||
query = query.orderByRaw(`?? ?? nulls ??`, [
|
identifier = this.rawQuotedIdentifier(key)
|
||||||
this.rawQuotedIdentifier(key),
|
} else if (this.client === SqlClient.ORACLE) {
|
||||||
this.knex.raw(direction),
|
identifier = this.convertClobs(composite)
|
||||||
this.knex.raw(nulls as string),
|
|
||||||
])
|
|
||||||
} else {
|
} else {
|
||||||
let composite = `${aliased}.${key}`
|
identifier = this.rawQuotedIdentifier(composite)
|
||||||
if (this.client === SqlClient.ORACLE) {
|
|
||||||
query = query.orderByRaw(`?? ?? nulls ??`, [
|
|
||||||
this.convertClobs(composite),
|
|
||||||
this.knex.raw(direction),
|
|
||||||
this.knex.raw(nulls as string),
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
query = query.orderByRaw(`?? ?? nulls ??`, [
|
|
||||||
this.rawQuotedIdentifier(composite),
|
|
||||||
this.knex.raw(direction),
|
|
||||||
this.knex.raw(nulls as string),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query = query.orderByRaw(`?? ?? ${nulls ? "nulls ??" : ""}`, [
|
||||||
|
identifier,
|
||||||
|
this.knex.raw(direction),
|
||||||
|
...(nulls ? [this.knex.raw(nulls as string)] : []),
|
||||||
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,6 +276,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
|
||||||
encrypt,
|
encrypt,
|
||||||
enableArithAbort: true,
|
enableArithAbort: true,
|
||||||
requestTimeout: env.QUERY_THREAD_TIMEOUT,
|
requestTimeout: env.QUERY_THREAD_TIMEOUT,
|
||||||
|
connectTimeout: env.QUERY_THREAD_TIMEOUT,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if (encrypt) {
|
if (encrypt) {
|
||||||
|
|
Loading…
Reference in New Issue