mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

This commit adds support for the explicit resource management proposal to the sqlite module. Refs: https://github.com/nodejs/node/pull/53752#discussion_r1667750387 PR-URL: https://github.com/nodejs/node/pull/57506 Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
19 lines
425 B
JavaScript
19 lines
425 B
JavaScript
'use strict';
|
|
const {
|
|
SymbolDispose,
|
|
} = primordials;
|
|
const { emitExperimentalWarning } = require('internal/util');
|
|
const binding = internalBinding('sqlite');
|
|
|
|
emitExperimentalWarning('SQLite');
|
|
|
|
// TODO(cjihrig): Move this to C++ once Symbol.dispose reaches Stage 4.
|
|
binding.DatabaseSync.prototype[SymbolDispose] = function() {
|
|
try {
|
|
this.close();
|
|
} catch {
|
|
// Ignore errors.
|
|
}
|
|
};
|
|
|
|
module.exports = binding;
|