mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Rename the DatabaseSync and StatementSync classes to Database and Statement, and the internal DatabaseSyncLimits helper to DatabaseLimits. The old names are kept as aliases of the new classes and are Documentation-only deprecated (DEP0210, DEP0211). Assisted-by: Claude Code Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65988 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
25 lines
813 B
JavaScript
25 lines
813 B
JavaScript
// This worker is used for one of the tests in test-sqlite-session.js
|
|
|
|
'use strict';
|
|
require('../common');
|
|
const { parentPort, workerData } = require('worker_threads');
|
|
const { Database, constants } = require('node:sqlite');
|
|
const { changeset, mode, dbPath } = workerData;
|
|
|
|
const db = new Database(dbPath);
|
|
|
|
const options = {};
|
|
if (mode !== constants.SQLITE_CHANGESET_ABORT && mode !== constants.SQLITE_CHANGESET_OMIT) {
|
|
throw new Error('Unexpected value for mode');
|
|
}
|
|
options.onConflict = () => mode;
|
|
|
|
try {
|
|
const result = db.applyChangeset(changeset, options);
|
|
parentPort.postMessage({ mode, result, error: null });
|
|
} catch (error) {
|
|
parentPort.postMessage({ mode, result: null, errorMessage: error.message, errcode: error.errcode });
|
|
} finally {
|
|
db.close(); // Just to make sure it is closed ASAP
|
|
}
|