Skip to content

Commit

Permalink
fix(sqlite): use keyword list from compiler (#526)
Browse files Browse the repository at this point in the history
related with #525
  • Loading branch information
patricebender authored Mar 14, 2024
1 parent c6993d9 commit a227c61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 150 deletions.
149 changes: 0 additions & 149 deletions sqlite/lib/ReservedWords.json

This file was deleted.

9 changes: 8 additions & 1 deletion sqlite/lib/SQLiteService.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ const $session = Symbol('dbc.session')
const convStrm = require('stream/consumers')
const { Readable } = require('stream')

const keywords = require('@sap/cds-compiler').to.sql.sqlite.keywords
// keywords come as array
const sqliteKeywords = keywords.reduce((prev, curr) => {
prev[curr] = 1
return prev
}, {})

class SQLiteService extends SQLService {
init() {
return super.init(...arguments)
Expand Down Expand Up @@ -242,7 +249,7 @@ class SQLiteService extends SQLService {
return 'is'
}

static ReservedWords = { ...super.ReservedWords, ...require('./ReservedWords.json') }
static ReservedWords = { ...super.ReservedWords, ...sqliteKeywords }
}

// REALLY REVISIT: Here we are doing error handling which we probably never should have started.
Expand Down

0 comments on commit a227c61

Please sign in to comment.