@sap/cds-sqlite
Advanced tools
Comparing version 1.11.1 to 1.16.0
@@ -9,2 +9,38 @@ # Changelog | ||
## Version 1.16.0 - 2019-08-21 | ||
### Changed | ||
- Signature of the Client's constructor | ||
## Version 1.15.0 - 2019-07-23 | ||
### Added | ||
- Support multi tenancy for file based database | ||
### Fixed | ||
- Streaming supports `null` values | ||
## Version 1.14.0 - 2019-07-09 | ||
### Added | ||
- Named binding parameters | ||
- Support files as db in tenant manager | ||
## Version 1.13.0 - 2019-06-24 | ||
### Changed | ||
- Updated version of @sap/cds-sql to 1.13.0 | ||
## Version 1.12.0 - 2019-05-24 | ||
### Changed | ||
- Updated version of @sap/cds-sql to 1.12.0 | ||
## Version 1.11.1 - 2019-05-16 | ||
@@ -11,0 +47,0 @@ |
@@ -35,6 +35,7 @@ const { Database } = require('sqlite3') | ||
* | ||
* @param {Object} credentials - Connection details. | ||
* @param {string} credentials.database - Filename to the database or :memory; for in memory | ||
* @param {Object} options - Connection details. | ||
* @param {Object} options.credentials - Connection details. | ||
* @param {string} options.credentials.database - Filename to the database or :memory; for in memory | ||
*/ | ||
constructor (credentials) { | ||
constructor ({ credentials }) { | ||
super([ | ||
@@ -133,3 +134,3 @@ ['cds.Boolean', convertToBoolean], | ||
if (!Array.isArray(values)) { | ||
if (!Array.isArray(values) && (typeof query !== 'string' || typeof values !== 'object')) { | ||
return reject(new IllegalFunctionArgumentError('values')) | ||
@@ -191,10 +192,11 @@ } | ||
const stream_ = new Readable() | ||
const val = Object.values(resultSet[0])[0] | ||
let val = Object.values(resultSet[0])[0] | ||
if (val === null) { | ||
return null | ||
} | ||
if (typeof val === 'number') { | ||
return | ||
val = val.toString() | ||
} | ||
const stream_ = new Readable() | ||
stream_.push(val) | ||
@@ -245,2 +247,7 @@ stream_.push(null) | ||
_executeSQL (sql, values, isOne, postMapper) { | ||
// support named binding parameters | ||
if (values && typeof values === 'object' && !Array.isArray(values)) { | ||
values = this._getValuesProxy(values) | ||
} | ||
if (this._isStatementType('select', sql)) { | ||
@@ -258,2 +265,22 @@ return this._executeSelect(sql, values, isOne, postMapper) | ||
_getValuesProxy (values) { | ||
return new Proxy(values, { | ||
getOwnPropertyDescriptor: (obj, prop) => { | ||
if (prop.length > 1 && prop.startsWith(':')) { | ||
return Object.getOwnPropertyDescriptor(obj, prop.slice(1)) | ||
} | ||
return Object.getOwnPropertyDescriptor(obj, prop) | ||
}, | ||
get: (obj, prop) => { | ||
if (prop.length > 1 && prop.startsWith(':')) { | ||
return obj[prop.slice(1)] | ||
} | ||
return obj[prop] | ||
}, | ||
ownKeys: target => { | ||
return Reflect.ownKeys(target).map(key => `:${key}`) | ||
} | ||
}) | ||
} | ||
_isStatementType (type, sql) { | ||
@@ -260,0 +287,0 @@ // Regex is faster than toLower + trim + startsWith |
@@ -22,2 +22,7 @@ const dependencies = { | ||
}, | ||
get TenantManager () { | ||
const TenantManager = require('./client/TenantManager') | ||
Object.defineProperty(dependencies, 'TenantManager', { value: TenantManager }) | ||
return TenantManager | ||
}, | ||
inject: (...args) => { | ||
@@ -24,0 +29,0 @@ return require('./cds').inject(...args) |
{ | ||
"name": "@sap/cds-sqlite", | ||
"version": "1.11.1", | ||
"version": "1.16.0", | ||
"lockfileVersion": 1, | ||
@@ -8,5 +8,11 @@ "requires": true, | ||
"@sap/cds-sql": { | ||
"version": "1.11.1" | ||
"version": "1.16.0", | ||
"requires": { | ||
"uuid": "3.3.2" | ||
} | ||
}, | ||
"uuid": { | ||
"version": "3.3.2" | ||
} | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
{"bundleDependencies":false,"dependencies":{"@sap/cds-sql":"1.11.1"},"deprecated":false,"description":"Driver package for access to sqlite database, including setting up the client, configuring all the necessary options to initiate the connection and handling database specifics so that they can be processed on our end.","engines":{"node":">= 8.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"{lib,test}/**/*.js":["prettier-standard","standard --fix","git add"]},"main":"lib/index.js","name":"@sap/cds-sqlite","version":"1.11.1","license":"SEE LICENSE IN developer-license-3.1.txt"} | ||
{"bundleDependencies":false,"dependencies":{"@sap/cds-sql":"1.16.0"},"deprecated":false,"description":"Driver package for access to sqlite database, including setting up the client, configuring all the necessary options to initiate the connection and handling database specifics so that they can be processed on our end.","engines":{"node":">= 8.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"{lib,test}/**/*.js":["prettier-standard","standard --fix","git add"]},"main":"lib/index.js","name":"@sap/cds-sqlite","version":"1.16.0","license":"SEE LICENSE IN developer-license-3.1.txt"} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63921
21
971
+ Added@sap/cds-sql@1.16.0(transitive)
+ Addeduuid@3.3.2(transitive)
- Removed@sap/cds-sql@1.11.1(transitive)
Updated@sap/cds-sql@1.16.0