Browse Source

fix: revise extractRawQueryAndExec logic

pull/2424/head
Wing-Kam Wong 2 years ago
parent
commit
85ffddd330
  1. 15
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

15
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2036,14 +2036,13 @@ class BaseModelSqlv2 {
private async extractRawQueryAndExec(qb: QueryBuilder) { private async extractRawQueryAndExec(qb: QueryBuilder) {
const query = unsanitize(qb.toQuery()); const query = unsanitize(qb.toQuery());
if (query.slice(0, 6) === 'select') { return this.isPg
return this.isPg ? (await this.dbDriver.raw(query))?.rows
? (await this.dbDriver.raw(query))?.rows : query.slice(0, 6) === 'select'
: await this.dbDriver.from( ? await this.dbDriver.from(
this.dbDriver.raw(query).wrap('(', ') __nc_alias') this.dbDriver.raw(query).wrap('(', ') __nc_alias')
); )
} : await this.dbDriver.raw(query);
return await this.dbDriver.raw(query);
} }
} }

Loading…
Cancel
Save