Socket
Socket
Sign inDemoInstall

@cap-js/sqlite

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cap-js/sqlite - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

lib/cql-functions.js

13

CHANGELOG.md

@@ -7,2 +7,15 @@ # Changelog

## [1.7.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.6.0...sqlite-v1.7.0) (2024-05-08)
### Added
* select decimals as strings if cds.env.features.string_decimals ([#616](https://github.com/cap-js/cds-dbs/issues/616)) ([39addbf](https://github.com/cap-js/cds-dbs/commit/39addbfe01da757d86a4d65e62eda86e59fc9b87))
### Fixed
* Change `sql` property to `query` for errors ([#611](https://github.com/cap-js/cds-dbs/issues/611)) ([585577a](https://github.com/cap-js/cds-dbs/commit/585577a9817e7749fb71958c26c4bfa20981c663))
* Improved placeholders and limit clause ([#567](https://github.com/cap-js/cds-dbs/issues/567)) ([d5d5dbb](https://github.com/cap-js/cds-dbs/commit/d5d5dbb7219bcef6134440715cf756fdd439f076))
## [1.6.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.5.1...sqlite-v1.6.0) (2024-03-22)

@@ -9,0 +22,0 @@

18

lib/SQLiteService.js

@@ -83,3 +83,3 @@ const { SQLService } = require('@cap-js/db-service')

} catch (e) {
e.message += ' in:\n' + (e.sql = sql)
e.message += ' in:\n' + (e.query = sql)
throw e

@@ -171,3 +171,4 @@ }

val(v) {
if (Buffer.isBuffer(v.val)) v.val = v.val.toString('base64')
if (typeof v.val === 'boolean') v.val = v.val ? 1 : 0
else if (Buffer.isBuffer(v.val)) v.val = v.val.toString('base64')
// intercept DateTime values and convert to Date objects to compare ISO Strings

@@ -194,3 +195,2 @@ else if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,9})?(Z|[+-]\d{2}(:?\d{2})?)$/.test(v.val)) {

...super.InputConverters,
// The following allows passing in ISO strings with non-zulu

@@ -200,3 +200,2 @@ // timezones and converts them into zulu dates and times

Time: e => `strftime('%H:%M:%S',${e})`,
// Both, DateTimes and Timestamps are canonicalized to ISO strings with

@@ -210,3 +209,2 @@ // ms precision to allow safe comparisons, also to query {val}s in where clauses

...super.OutputConverters,
// Structs and arrays are stored as JSON strings; the ->'$' unwraps them.

@@ -217,9 +215,6 @@ // Otherwise they would be added as strings to json_objects.

array: expr => `${expr}->'$'`,
// SQLite has no booleans so we need to convert 0 and 1
boolean: expr => `CASE ${expr} when 1 then 'true' when 0 then 'false' END ->'$'`,
// DateTimes are returned without ms added by InputConverters
DateTime: e => `substr(${e},0,20)||'Z'`,
// Timestamps are returned with ms, as written by InputConverters.

@@ -229,7 +224,8 @@ // And as cds.builtin.classes.Timestamp inherits from DateTime we need

Timestamp: undefined,
// int64 is stored as native int64 for best comparison
// Reading int64 as string to not loose precision
Int64: expr => `CAST(${expr} as TEXT)`,
// REVISIT: always cast to string in next major
// Reading decimal as string to not loose precision
Decimal: cds.env.features.string_decimals ? expr => `CAST(${expr} as TEXT)` : undefined,
// Binary is not allowed in json objects

@@ -240,3 +236,3 @@ Binary: expr => `${expr} || ''`,

// Used for SQL function expressions
static Functions = { ...super.Functions, ...require('./func') }
static Functions = { ...super.Functions, ...require('./cql-functions') }

@@ -243,0 +239,0 @@ // Used for CREATE TABLE statements

{
"name": "@cap-js/sqlite",
"version": "1.6.0",
"version": "1.7.0",
"description": "CDS database service for SQLite",

@@ -33,3 +33,3 @@ "homepage": "https://github.com/cap-js/cds-dbs/tree/main/sqlite#cds-database-service-for-sqlite",

"dependencies": {
"@cap-js/db-service": "^1.7.0",
"@cap-js/db-service": "^1.9.0",
"better-sqlite3": "^9.3.0"

@@ -36,0 +36,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc