mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
sqlite: add sqlite-type symbol for DatabaseSync
PR-URL: https://github.com/nodejs/node/pull/59405 Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
This commit is contained in:
parent
52f616d42f
commit
d1eabcb044
|
|
@ -2759,6 +2759,13 @@ static void Initialize(Local<Object> target,
|
|||
db_tmpl,
|
||||
FIXED_ONE_BYTE_STRING(isolate, "isTransaction"),
|
||||
DatabaseSync::IsTransactionGetter);
|
||||
Local<String> sqlite_type_key = FIXED_ONE_BYTE_STRING(isolate, "sqlite-type");
|
||||
Local<v8::Symbol> sqlite_type_symbol =
|
||||
v8::Symbol::For(isolate, sqlite_type_key);
|
||||
Local<String> database_sync_string =
|
||||
FIXED_ONE_BYTE_STRING(isolate, "node:sqlite");
|
||||
db_tmpl->InstanceTemplate()->Set(sqlite_type_symbol, database_sync_string);
|
||||
|
||||
SetConstructorFunction(context, target, "DatabaseSync", db_tmpl);
|
||||
SetConstructorFunction(context,
|
||||
target,
|
||||
|
|
|
|||
|
|
@ -281,6 +281,15 @@ suite('DatabaseSync() constructor', () => {
|
|||
{ changes: 1, lastInsertRowid: 1 },
|
||||
);
|
||||
});
|
||||
|
||||
test('has sqlite-type symbol property', (t) => {
|
||||
const dbPath = nextDb();
|
||||
const db = new DatabaseSync(dbPath);
|
||||
t.after(() => { db.close(); });
|
||||
|
||||
const sqliteTypeSymbol = Symbol.for('sqlite-type');
|
||||
t.assert.strictEqual(db[sqliteTypeSymbol], 'node:sqlite');
|
||||
});
|
||||
});
|
||||
|
||||
suite('DatabaseSync.prototype.open()', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user