Skip to content

Commit

Permalink
fix(hana): use keyword list from compiler (#525)
Browse files Browse the repository at this point in the history
today we updated the keywords in the compiler because new hana version
came with some new keywords. Instead of copying the keywords to this
repo, we should rather import the list from the compiler to get rid of
this double maintenance.

I already requested that also keywords for other sql dialects will be
available in a similar fashion.
  • Loading branch information
patricebender authored Mar 14, 2024
1 parent 61d348e commit c6993d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 522 deletions.
8 changes: 7 additions & 1 deletion hana/lib/HANAService.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ const { SQLService } = require('@cap-js/db-service')
const drivers = require('./drivers')
const cds = require('@sap/cds')
const collations = require('./collations.json')
const keywords = require('@sap/cds-compiler').to.hdi.keywords
// keywords come as array
const hanaKeywords = keywords.reduce((prev, curr) => {
prev[curr] = 1
return prev
}, {})

const DEBUG = cds.debug('sql|db')
let HANAVERSION = 0
Expand Down Expand Up @@ -927,7 +933,7 @@ class HANAService extends SQLService {
}

// Loads a static result from the query `SELECT * FROM RESERVED_KEYWORDS`
static ReservedWords = { ...super.ReservedWords, ...require('./ReservedWords.json') }
static ReservedWords = { ...super.ReservedWords, ...hanaKeywords }

static Functions = require('./cql-functions')

Expand Down
Loading

0 comments on commit c6993d9

Please sign in to comment.