From cd1e7c0bad0b03f2c5defe7a0cf7f9adcbf1e52b Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 14 Jun 2024 19:04:02 +0100 Subject: [PATCH] Small re-jig make things easier to read. --- .../server/src/api/controllers/row/ExternalRequest.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index 98bd5412d4..1679892d03 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -672,15 +672,16 @@ export class ExternalRequest { // aliasing can be disabled fully if desired let response const aliasing = new sdk.rows.AliasTables(Object.keys(this.tables)) - if (env.SQL_ALIASING_DISABLE) { - response = await getDatasourceAndQuery(json) - } else if (this.operation === Operation.COUNT) { + // if it's a counting operation there will be no more processing, just return the number + if (this.operation === Operation.COUNT) { return (await aliasing.countWithAliasing( json, makeExternalQuery )) as ExternalRequestReturnType } 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 : []