Skip to content

Commit

Permalink
fix(cqn2sql): supporting calculated elements (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
danjoa authored Dec 18, 2023
1 parent c2d773c commit 2153fb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db-service/lib/cqn2sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class CQN2SQLRenderer {
return // REVISIT: mtx sends an insert statement without entries and no reference entity
}
const columns = elements
? ObjectKeys(elements).filter(c => c in elements && !elements[c].virtual && !elements[c].isAssociation)
? ObjectKeys(elements).filter(c => c in elements && !elements[c].virtual && !elements[c].value && !elements[c].isAssociation)
: ObjectKeys(INSERT.entries[0])

/** @type {string[]} */
Expand Down
3 changes: 2 additions & 1 deletion hana/lib/HANAService.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ class HANAService extends SQLService {
return foreignKeys
}

// REVISIT: Find a way to avoid overriding the whole function redundantly
INSERT_entries(q) {
this.values = undefined
const { INSERT } = q
Expand All @@ -527,7 +528,7 @@ class HANAService extends SQLService {
return // REVISIT: mtx sends an insert statement without entries and no reference entity
}
const columns = elements
? ObjectKeys(elements).filter(c => c in elements && !elements[c].virtual && !elements[c].isAssociation)
? ObjectKeys(elements).filter(c => c in elements && !elements[c].virtual && !elements[c].value && !elements[c].isAssociation)
: ObjectKeys(INSERT.entries[0])
this.columns = columns.filter(elements ? c => !elements[c]?.['@cds.extension'] : () => true)

Expand Down

0 comments on commit 2153fb9

Please sign in to comment.