wrappers.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. const { cppdb } = require('../util');
  3. exports.prepare = function prepare(sql) {
  4. return this[cppdb].prepare(sql, this, false);
  5. };
  6. exports.exec = function exec(sql) {
  7. this[cppdb].exec(sql);
  8. return this;
  9. };
  10. exports.close = function close() {
  11. this[cppdb].close();
  12. return this;
  13. };
  14. exports.loadExtension = function loadExtension(...args) {
  15. this[cppdb].loadExtension(...args);
  16. return this;
  17. };
  18. exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
  19. this[cppdb].defaultSafeIntegers(...args);
  20. return this;
  21. };
  22. exports.unsafeMode = function unsafeMode(...args) {
  23. this[cppdb].unsafeMode(...args);
  24. return this;
  25. };
  26. exports.getters = {
  27. name: {
  28. get: function name() { return this[cppdb].name; },
  29. enumerable: true,
  30. },
  31. open: {
  32. get: function open() { return this[cppdb].open; },
  33. enumerable: true,
  34. },
  35. inTransaction: {
  36. get: function inTransaction() { return this[cppdb].inTransaction; },
  37. enumerable: true,
  38. },
  39. readonly: {
  40. get: function readonly() { return this[cppdb].readonly; },
  41. enumerable: true,
  42. },
  43. memory: {
  44. get: function memory() { return this[cppdb].memory; },
  45. enumerable: true,
  46. },
  47. };