@cap-js/sqlite 1.7.3 → 1.7.5

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 CHANGED
@@ -4,6 +4,21 @@
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
+ ## [1.7.5](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.7.4...sqlite-v1.7.5) (2024-10-28)
8
+
9
+
10
+ ### Fixed
11
+
12
+ * properly support `default`, `cds.on.insert` and `cds.on.update` for `UPSERT` queries ([#425](https://github.com/cap-js/cds-dbs/issues/425)) ([338e9f5](https://github.com/cap-js/cds-dbs/commit/338e9f5de9109d36013208547fc648c17ce8c7b0))
13
+
14
+ ## [1.7.4](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.7.3...sqlite-v1.7.4) (2024-10-15)
15
+
16
+
17
+ ### Fixed
18
+
19
+ * enforce db file to be existent before server start ([#742](https://github.com/cap-js/cds-dbs/issues/742)) ([64a9018](https://github.com/cap-js/cds-dbs/commit/64a90186aaf44b3426df2e9adbf9a1b4cf2f92b7))
20
+ * Improved behavioral consistency between the database services ([#837](https://github.com/cap-js/cds-dbs/issues/837)) ([b6f7187](https://github.com/cap-js/cds-dbs/commit/b6f718701e48dfb1c4c3d98ee016ec45930f8e7b))
21
+
7
22
  ## [1.7.3](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.7.2...sqlite-v1.7.3) (2024-07-09)
8
23
 
9
24
 
package/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # CDS database service for SQLite
2
2
 
3
- Welcome to the new SQLite database service for [SAP Cloud Application Programming Model](https://cap.cloud.sap) Node.js, based on new, streamlined database architecture and [*better-sqlite* driver](https://www.npmjs.com/package/better-sqlite3) .
3
+ Welcome to the SQLite database service for [SAP Cloud Application Programming Model](https://cap.cloud.sap) Node.js, based on streamlined database architecture and [*better-sqlite* driver](https://www.npmjs.com/package/better-sqlite3).
4
4
 
5
5
  ## Setup
6
6
 
7
- In general, all you need to do is to install one of the database packages, as follows:
8
-
9
- Using SQLite for development:
7
+ If you want to use SQLite for development, all you need to do is to install the database package, as follows
10
8
 
11
9
  ```sh
12
10
  npm add @cap-js/sqlite -D
@@ -33,4 +31,4 @@ We as members, contributors, and leaders pledge to make participation in our com
33
31
 
34
32
  ## Licensing
35
33
 
36
- Copyright 2023 SAP SE or an SAP affiliate company and cds-dbs contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/cap-js/cds-dbs).
34
+ Copyright 2024 SAP SE or an SAP affiliate company and cds-dbs contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/cap-js/cds-dbs).
@@ -192,12 +192,12 @@ class SQLiteService extends SQLService {
192
192
  ...super.InputConverters,
193
193
  // The following allows passing in ISO strings with non-zulu
194
194
  // timezones and converts them into zulu dates and times
195
- Date: e => `strftime('%Y-%m-%d',${e})`,
196
- Time: e => `strftime('%H:%M:%S',${e})`,
195
+ Date: e => e === '?' ? e : `strftime('%Y-%m-%d',${e})`,
196
+ Time: e => e === '?' ? e : `strftime('%H:%M:%S',${e})`,
197
197
  // Both, DateTimes and Timestamps are canonicalized to ISO strings with
198
198
  // ms precision to allow safe comparisons, also to query {val}s in where clauses
199
- DateTime: e => `ISO(${e})`,
200
- Timestamp: e => `ISO(${e})`,
199
+ DateTime: e => e === '?' ? e : `ISO(${e})`,
200
+ Timestamp: e => e === '?' ? e : `ISO(${e})`,
201
201
  }
202
202
 
203
203
  static OutputConverters = {
@@ -220,7 +220,10 @@ class SQLiteService extends SQLService {
220
220
  Int64: cds.env.features.ieee754compatible ? expr => `CAST(${expr} as TEXT)` : undefined,
221
221
  // REVISIT: always cast to string in next major
222
222
  // Reading decimal as string to not loose precision
223
- Decimal: cds.env.features.ieee754compatible ? expr => `CAST(${expr} as TEXT)` : undefined,
223
+ Decimal: cds.env.features.ieee754compatible ? (expr, elem) => elem?.scale
224
+ ? `CASE WHEN ${expr} IS NULL THEN NULL ELSE format('%.${elem.scale}f', ${expr}) END`
225
+ : `CAST(${expr} as TEXT)`
226
+ : undefined,
224
227
  // Binary is not allowed in json objects
225
228
  Binary: expr => `${expr} || ''`,
226
229
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/sqlite",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
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": {
@@ -23,7 +23,7 @@
23
23
  "CHANGELOG.md"
24
24
  ],
25
25
  "scripts": {
26
- "test": "jest --silent"
26
+ "test": "cds-test $(../test/find)"
27
27
  },
28
28
  "dependencies": {
29
29
  "@cap-js/db-service": "^1.9.0",