@cap-js/sqlite 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/SQLiteService.js +10 -11
- package/lib/func.js +17 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
- The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
5
5
|
- This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## Version 1.3.1 - 2023-10-10
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Updated minimum required version of `@cap-js/db-service`.
|
|
12
|
+
|
|
7
13
|
## Version 1.3.0 - 2023-10-06
|
|
8
14
|
|
|
9
15
|
### Fixed
|
package/lib/SQLiteService.js
CHANGED
|
@@ -15,7 +15,9 @@ class SQLiteService extends SQLService {
|
|
|
15
15
|
dbc.function('session_context', key => dbc[$session][key])
|
|
16
16
|
dbc.function('regexp', { deterministic: true }, (re, x) => (RegExp(re).test(x) ? 1 : 0))
|
|
17
17
|
dbc.function('ISO', { deterministic: true }, d => d && new Date(d).toISOString())
|
|
18
|
-
dbc.function('json_merge', { varargs: true, deterministic: true }, (...args) =>
|
|
18
|
+
dbc.function('json_merge', { varargs: true, deterministic: true }, (...args) =>
|
|
19
|
+
args.join('').replace(/}{/g, ','),
|
|
20
|
+
)
|
|
19
21
|
if (!dbc.memory) dbc.pragma('journal_mode = WAL')
|
|
20
22
|
return dbc
|
|
21
23
|
},
|
|
@@ -136,7 +138,6 @@ class SQLiteService extends SQLService {
|
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
static CQN2SQL = class CQN2SQLite extends SQLService.CQN2SQL {
|
|
139
|
-
|
|
140
141
|
column_alias4(x, q) {
|
|
141
142
|
let alias = super.column_alias4(x, q)
|
|
142
143
|
if (alias) return alias
|
|
@@ -201,13 +202,7 @@ class SQLiteService extends SQLService {
|
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
// Used for SQL function expressions
|
|
204
|
-
static Functions = { ...super.Functions,
|
|
205
|
-
// Ensure ISO strings are returned for date/time functions
|
|
206
|
-
current_timestamp: () => 'ISO(current_timestamp)',
|
|
207
|
-
// SQLite doesn't support arguments for current_date and current_time
|
|
208
|
-
current_date: () => 'current_date',
|
|
209
|
-
current_time: () => 'current_time',
|
|
210
|
-
}
|
|
205
|
+
static Functions = { ...super.Functions, ...require('./func') }
|
|
211
206
|
|
|
212
207
|
// Used for CREATE TABLE statements
|
|
213
208
|
static TypeMap = {
|
|
@@ -219,8 +214,12 @@ class SQLiteService extends SQLService {
|
|
|
219
214
|
Timestamp: () => 'TIMESTAMP_TEXT',
|
|
220
215
|
}
|
|
221
216
|
|
|
222
|
-
get is_distinct_from_() {
|
|
223
|
-
|
|
217
|
+
get is_distinct_from_() {
|
|
218
|
+
return 'is not'
|
|
219
|
+
}
|
|
220
|
+
get is_not_distinct_from_() {
|
|
221
|
+
return 'is'
|
|
222
|
+
}
|
|
224
223
|
|
|
225
224
|
static ReservedWords = { ...super.ReservedWords, ...require('./ReservedWords.json') }
|
|
226
225
|
}
|
package/lib/func.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const StandardFunctions = {
|
|
4
|
+
// Ensure ISO strings are returned for date/time functions
|
|
5
|
+
current_timestamp: () => 'ISO(current_timestamp)',
|
|
6
|
+
// SQLite doesn't support arguments for current_date and current_time
|
|
7
|
+
current_date: () => 'current_date',
|
|
8
|
+
current_time: () => 'current_time',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const HANAFunctions = {
|
|
12
|
+
/** defined in db-service */
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (let each in HANAFunctions) HANAFunctions[each.toUpperCase()] = HANAFunctions[each]
|
|
16
|
+
|
|
17
|
+
module.exports = { ...StandardFunctions, ...HANAFunctions }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/sqlite",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "CDS database service for SQLite",
|
|
5
5
|
"homepage": "https://github.com/cap-js/cds-dbs/tree/main/sqlite#cds-database-service-for-sqlite",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "jest --silent"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@cap-js/db-service": "^1.3.
|
|
33
|
+
"@cap-js/db-service": "^1.3.1",
|
|
34
34
|
"better-sqlite3": "^8"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|