Browse Source

Merge pull request #5293 from nocodb/fix/pg-checkbox-filter

fix(nocodb): sanitize / unsanitize logic
pull/5301/head
Raju Udava 2 years ago committed by GitHub
parent
commit
d0cb229542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

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

@ -323,7 +323,14 @@ class BaseModelSqlv2 {
qb.count(sanitize(this.model.primaryKey?.column_name) || '*', { qb.count(sanitize(this.model.primaryKey?.column_name) || '*', {
as: 'count', as: 'count',
}).first(); }).first();
const res = (await this.dbDriver.raw(unsanitize(qb.toQuery()))) as any;
let sql = sanitize(qb.toQuery());
if (!this.isPg && !this.isMssql && !this.isSnowflake) {
sql = unsanitize(qb.toQuery());
}
const res = (await this.dbDriver.raw(sql)) as any;
return (this.isPg || this.isSnowflake ? res.rows[0] : res[0][0] ?? res[0]) return (this.isPg || this.isSnowflake ? res.rows[0] : res[0][0] ?? res[0])
.count; .count;
} }

Loading…
Cancel
Save