Skip to content

Commit 3490c75

Browse files
LiviaMedeirosaduh95
authored andcommitted
sqlite: set name and length on sqlite.backup()
PR-URL: #58251 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 1b38476 commit 3490c75

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

β€Žsrc/node_sqlite.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2687,9 +2687,11 @@ static void Initialize(Local<Object> target,
26872687

26882688
Local<Function> backup_function;
26892689

2690-
if (!Function::New(context, Backup).ToLocal(&backup_function)) {
2690+
if (!Function::New(context, Backup, Local<Value>(), 2)
2691+
.ToLocal(&backup_function)) {
26912692
return;
26922693
}
2694+
backup_function->SetName(env->backup_string());
26932695

26942696
target->Set(context, env->backup_string(), backup_function).Check();
26952697
}

β€Žtest/parallel/test-sqlite-backup.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,8 @@ test('backup fails when destination cannot be opened', async (t) => {
234234
message: 'unable to open database file'
235235
});
236236
});
237+
238+
test('backup has correct name and length', (t) => {
239+
t.assert.strictEqual(backup.name, 'backup');
240+
t.assert.strictEqual(backup.length, 2);
241+
});

0 commit comments

Comments
 (0)