Skip to content

Commit 69636b6

Browse files
authored
chore: update where_resolve for quoted mode (#1515)
1 parent 760d483 commit 69636b6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

db-service/lib/cqn2sql.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,12 @@ class CQN2SQLRenderer {
748748

749749
/**
750750
* Renders a transformed where clause that maps the query target view to the source table
751-
* @param {import('./infer/cqn').source} from
751+
* @param {import('./infer/cqn').source} alias
752752
* @param {import('./infer/cqn').predicate} where
753753
* @param {import('./infer/cqn').query} q
754754
* @returns SQL
755755
*/
756-
where_resolved(from, where, q) {
756+
where_resolved(alias, where, q) {
757757
const transitions = this.srv.resolve.transitions4db(q)
758758
if (transitions.target === transitions.queryTarget) return this.where(where)
759759

@@ -774,7 +774,7 @@ class CQN2SQLRenderer {
774774
}
775775
}
776776
return tableCols.length > 0
777-
? this.where([{ list: tableCols }, 'in', SELECT.from(from).columns(viewCols).where(where)])
777+
? this.where([{ list: tableCols }, 'in', SELECT.from(q._target).alias(alias).columns(viewCols).where(where)])
778778
: this.where(where)
779779
}
780780

@@ -1222,7 +1222,7 @@ class CQN2SQLRenderer {
12221222
}).map((c, i) => `${this.quote(transitions.mapping.get(c.name)?.ref?.[0] || c.name)}=${!columns[i] ? c.onUpdate : c.sql}`)
12231223

12241224
sql += ` SET ${extraction}`
1225-
if (where) sql += ` WHERE ${this.where_resolved(entity, where, q)}`
1225+
if (where) sql += ` WHERE ${this.where_resolved(entity.as, where, q)}`
12261226
return (this.sql = sql)
12271227
}
12281228

0 commit comments

Comments
 (0)