@saltcorn/sqlite-mobile
Advanced tools
Comparing version 0.9.6-beta.11 to 0.9.6-beta.12
@@ -32,2 +32,3 @@ /** | ||
replace?: boolean; | ||
jsonCols?: string[]; | ||
}) => Promise<string | void>; | ||
@@ -89,4 +90,7 @@ /** | ||
* @param id | ||
* @param opts | ||
*/ | ||
export declare const update: (tbl: string, obj: Row, id: string | number) => Promise<void>; | ||
export declare const update: (tbl: string, obj: Row, id: string | number, opts?: { | ||
jsonCols?: string[]; | ||
}) => Promise<void>; | ||
/** | ||
@@ -93,0 +97,0 @@ * Add unique constraint |
@@ -170,7 +170,12 @@ "use strict"; | ||
* @param id | ||
* @param opts | ||
*/ | ||
const update = async (tbl, obj, id) => { | ||
const update = async (tbl, obj, id, opts = {}) => { | ||
const kvs = Object.entries(obj); | ||
const assigns = kvs.map(([k, v], ix) => `"${(0, internal_1.sqlsanitize)(k)}"=?`).join(); | ||
let valList = kvs.map(sqlite_commons_1.mkVal); | ||
const assigns = kvs | ||
.map(([k, v], ix) => `"${(0, internal_1.sqlsanitize)(k)}"=${opts.jsonCols?.includes(k) && (v === true || v === false) | ||
? "json(?)" | ||
: "?"}`) | ||
.join(); | ||
let valList = kvs.map(([k, v]) => (0, sqlite_commons_1.mkVal)([k, v], opts.jsonCols?.includes(k))); | ||
valList.push(id); | ||
@@ -177,0 +182,0 @@ const q = `update "${(0, internal_1.sqlsanitize)(tbl)}" set ${assigns} where id=?`; |
{ | ||
"name": "@saltcorn/sqlite-mobile", | ||
"version": "0.9.6-beta.11", | ||
"version": "0.9.6-beta.12", | ||
"description": "cordova-sqlite-storage structures for Saltcorn, open-source no-code platform", | ||
@@ -29,3 +29,3 @@ "homepage": "https://saltcorn.com", | ||
"dependencies": { | ||
"@saltcorn/db-common": "0.9.6-beta.11" | ||
"@saltcorn/db-common": "0.9.6-beta.12" | ||
}, | ||
@@ -32,0 +32,0 @@ "repository": "github:saltcorn/saltcorn", |
Sorry, the diff of this file is not supported yet
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
21518
431
+ Added@saltcorn/db-common@0.9.6-beta.12(transitive)
- Removed@saltcorn/db-common@0.9.6-beta.11(transitive)