Skip to content

Commit 45f7169

Browse files
committed
sqlite: set name and length on sqlite.backup()
1 parent e5e8eaa commit 45f7169

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/node_sqlite.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2686,9 +2686,13 @@ static void Initialize(Local<Object> target,
26862686

26872687
Local<Function> backup_function;
26882688

2689-
if (!Function::New(context, Backup).ToLocal(&backup_function)) {
2689+
if (!Function::New(context,
2690+
Backup,
2691+
Local<Value>(),
2692+
2).ToLocal(&backup_function)) {
26902693
return;
26912694
}
2695+
backup_function->SetName(FIXED_ONE_BYTE_STRING(isolate, "backup"));
26922696

26932697
target->Set(context, env->backup_string(), backup_function).Check();
26942698
}

test/parallel/test-sqlite-backup.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,8 @@ test('backup fails when path cannot be opened', async (t) => {
307307
message: 'unable to open database file'
308308
});
309309
});
310+
311+
test('backup has correct name and length', (t) => {
312+
t.assert.strictEqual(backup.name, 'backup');
313+
t.assert.strictEqual(backup.length, 2);
314+
});

0 commit comments

Comments
 (0)