From a311180478357350d04da9024e1e0b6faccfe9e3 Mon Sep 17 00:00:00 2001 From: scola Date: Tue, 29 Oct 2024 21:34:03 +0100 Subject: [PATCH] Add getRowsModified to worker (#596) --- src/worker.js | 5 +++++ test/test_worker.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/worker.js b/src/worker.js index f75bf6a1..9aa544f8 100644 --- a/src/worker.js +++ b/src/worker.js @@ -35,6 +35,11 @@ function onModuleReady(SQL) { id: data["id"], results: db.exec(data["sql"], data["params"], config) }); + case "getRowsModified": + return postMessage({ + id: data["id"], + rowsModified: db.getRowsModified() + }); case "each": if (db === null) { createDb(); diff --git a/test/test_worker.js b/test/test_worker.js index 42aa2392..64128401 100644 --- a/test/test_worker.js +++ b/test/test_worker.js @@ -118,6 +118,9 @@ exports.test = async function test(SQL, assert) { assert.strictEqual(table.values[2][1], 'c', 'Reading string'); assert.deepEqual(obj2array(table.values[2][2]), [0x00, 0x44], 'Reading BLOB byte'); + data = await worker.postMessage({ action: 'getRowsModified' }); + assert.equal(data.rowsModified, 1, 'Number of changed rows') + data = await worker.postMessage({ action: 'export' }); var header = "SQLite format 3\0"; var actual = "";