diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index 23caac7d383df8..e78e47f7509879 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -182,7 +182,7 @@ class BackupJob : public ThreadPoolWork { Local e = Local(); if (backup_status_ != SQLITE_OK) { - CreateSQLiteError(isolate, pDest_).ToLocal(&e); + e = CreateSQLiteError(isolate, pDest_).ToLocalChecked(); Cleanup(); @@ -195,7 +195,7 @@ class BackupJob : public ThreadPoolWork { pDest_, dest_db_.c_str(), source_->Connection(), source_db_.c_str()); if (pBackup_ == nullptr) { - CreateSQLiteError(isolate, pDest_).ToLocal(&e); + e = CreateSQLiteError(isolate, pDest_).ToLocalChecked(); sqlite3_close(pDest_); @@ -209,8 +209,6 @@ class BackupJob : public ThreadPoolWork { void DoThreadPoolWork() override { backup_status_ = sqlite3_backup_step(pBackup_, pages_); - - const char* errstr = sqlite3_errstr(backup_status_); } void AfterThreadPoolWork(int status) override { @@ -227,9 +225,8 @@ class BackupJob : public ThreadPoolWork { if (!(backup_status_ == SQLITE_OK || backup_status_ == SQLITE_DONE || backup_status_ == SQLITE_BUSY || backup_status_ == SQLITE_LOCKED)) { - Local e = Local(); - - CreateSQLiteError(env()->isolate(), backup_status_).ToLocal(&e); + Local e = + CreateSQLiteError(env()->isolate(), backup_status_).ToLocalChecked(); Cleanup(); @@ -275,8 +272,8 @@ class BackupJob : public ThreadPoolWork { env()->isolate(), "Backup completed", NewStringType::kNormal) .ToLocalChecked(); - Local e = Local(); - CreateSQLiteError(env()->isolate(), pDest_).ToLocal(&e); + Local e = + CreateSQLiteError(env()->isolate(), pDest_).ToLocalChecked(); Cleanup(); @@ -826,8 +823,8 @@ void DatabaseSync::Backup(const FunctionCallbackInfo& args) { } Local resolver = Promise::Resolver::New(env->context()) - .ToLocalChecked() - .As(); + .ToLocalChecked() + .As(); args.GetReturnValue().Set(resolver->GetPromise()); diff --git a/test/parallel/test-sqlite-backup.mjs b/test/parallel/test-sqlite-backup.mjs index 4043345f9718fe..c9ec6bbb4ea1b8 100644 --- a/test/parallel/test-sqlite-backup.mjs +++ b/test/parallel/test-sqlite-backup.mjs @@ -1,4 +1,4 @@ -import common from '../common/index.js'; +import * as common from '../common/index.mjs'; import tmpdir from '../common/tmpdir.js'; import { join } from 'path'; import { DatabaseSync } from 'node:sqlite'; @@ -58,7 +58,8 @@ test('database backup', async (t) => { const backup = new DatabaseSync(destDb); const rows = backup.prepare('SELECT * FROM data').all(); - // The source database has two pages - using the default page size -, so the progress function should be called once (the last call is not made since + // The source database has two pages - using the default page size -, + // so the progress function should be called once (the last call is not made since // the promise resolves) t.assert.strictEqual(progressFn.mock.calls.length, 1); t.assert.deepStrictEqual(rows, [ @@ -80,4 +81,3 @@ test('database backup fails when dest file is not writable', (t) => { message: 'attempt to write a readonly database' })); }); -