Small re-jig make things easier to read.

This commit is contained in:
mike12345567 2024-06-14 19:04:02 +01:00
parent f3ca1d0b1e
commit cd1e7c0bad
1 changed files with 5 additions and 4 deletions

View File

@ -672,15 +672,16 @@ export class ExternalRequest<T extends Operation> {
// aliasing can be disabled fully if desired // aliasing can be disabled fully if desired
let response let response
const aliasing = new sdk.rows.AliasTables(Object.keys(this.tables)) const aliasing = new sdk.rows.AliasTables(Object.keys(this.tables))
if (env.SQL_ALIASING_DISABLE) { // if it's a counting operation there will be no more processing, just return the number
response = await getDatasourceAndQuery(json) if (this.operation === Operation.COUNT) {
} else if (this.operation === Operation.COUNT) {
return (await aliasing.countWithAliasing( return (await aliasing.countWithAliasing(
json, json,
makeExternalQuery makeExternalQuery
)) as ExternalRequestReturnType<T> )) as ExternalRequestReturnType<T>
} else { } else {
response = await aliasing.queryWithAliasing(json, makeExternalQuery) response = env.SQL_ALIASING_DISABLE
? await getDatasourceAndQuery(json)
: await aliasing.queryWithAliasing(json, makeExternalQuery)
} }
const responseRows = Array.isArray(response) ? response : [] const responseRows = Array.isArray(response) ? response : []