better-sqlite3-multiple-ciphers 7.4.6-beta.0 → 7.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +14 -7
  2. package/deps/download.sh +111 -108
  3. package/deps/setup.ps1 +10 -12
  4. package/deps/sqlite3/sqlite3.c +272560 -0
  5. package/deps/sqlite3/sqlite3.h +12770 -0
  6. package/deps/sqlite3/sqlite3ext.h +675 -0
  7. package/deps/sqlite3.gyp +13 -7
  8. package/deps/symlink.js +7 -4
  9. package/lib/database.js +17 -6
  10. package/lib/sqlite-error.js +1 -2
  11. package/package.json +10 -4
  12. package/src/better_sqlite3.cpp +46 -35
  13. package/src/better_sqlite3.hpp +40 -38
  14. package/.gitattributes +0 -1
  15. package/.github/workflows/prebuild.yml +0 -49
  16. package/.github/workflows/test.yml +0 -59
  17. package/benchmark/benchmark.js +0 -31
  18. package/benchmark/drivers.js +0 -21
  19. package/benchmark/index.js +0 -83
  20. package/benchmark/seed.js +0 -47
  21. package/benchmark/trials.js +0 -65
  22. package/benchmark/types/insert.js +0 -16
  23. package/benchmark/types/select-all.js +0 -14
  24. package/benchmark/types/select-iterate.js +0 -23
  25. package/benchmark/types/select.js +0 -14
  26. package/benchmark/types/transaction.js +0 -40
  27. package/deps/extract.js +0 -16
  28. package/deps/sqlite3.tar.gz +0 -0
  29. package/docs/api.md +0 -645
  30. package/docs/benchmark.md +0 -38
  31. package/docs/compilation.md +0 -76
  32. package/docs/integer.md +0 -79
  33. package/docs/performance.md +0 -39
  34. package/docs/threads.md +0 -97
  35. package/docs/tips.md +0 -35
  36. package/docs/troubleshooting.md +0 -23
  37. package/docs/unsafe.md +0 -16
  38. package/src/better_sqlite3.lzz +0 -88
  39. package/src/objects/backup.lzz +0 -138
  40. package/src/objects/database.lzz +0 -468
  41. package/src/objects/statement-iterator.lzz +0 -138
  42. package/src/objects/statement.lzz +0 -323
  43. package/src/util/bind-map.lzz +0 -73
  44. package/src/util/binder.lzz +0 -190
  45. package/src/util/constants.lzz +0 -151
  46. package/src/util/custom-aggregate.lzz +0 -121
  47. package/src/util/custom-function.lzz +0 -59
  48. package/src/util/custom-table.lzz +0 -397
  49. package/src/util/data-converter.lzz +0 -17
  50. package/src/util/data.lzz +0 -145
  51. package/src/util/macros.lzz +0 -159
  52. package/src/util/query-macros.lzz +0 -71
  53. package/test/00.setup.js +0 -25
  54. package/test/01.sqlite-error.js +0 -27
  55. package/test/10.database.open.js +0 -159
  56. package/test/11.database.close.js +0 -68
  57. package/test/12.database.pragma.js +0 -65
  58. package/test/13.database.prepare.js +0 -60
  59. package/test/14.database.exec.js +0 -46
  60. package/test/20.statement.run.js +0 -170
  61. package/test/21.statement.get.js +0 -109
  62. package/test/22.statement.all.js +0 -129
  63. package/test/23.statement.iterate.js +0 -223
  64. package/test/24.statement.bind.js +0 -107
  65. package/test/25.statement.columns.js +0 -46
  66. package/test/30.database.transaction.js +0 -157
  67. package/test/31.database.checkpoint.js +0 -62
  68. package/test/32.database.function.js +0 -211
  69. package/test/33.database.aggregate.js +0 -603
  70. package/test/34.database.table.js +0 -671
  71. package/test/35.database.load-extension.js +0 -75
  72. package/test/36.database.backup.js +0 -240
  73. package/test/37.database.serialize.js +0 -81
  74. package/test/40.bigints.js +0 -145
  75. package/test/41.at-exit.js +0 -52
  76. package/test/42.integrity.js +0 -531
  77. package/test/43.verbose.js +0 -100
  78. package/test/44.worker-threads.js +0 -66
  79. package/test/45.unsafe-mode.js +0 -52
  80. package/test/46.encryption.js +0 -31
  81. package/test/50.misc.js +0 -44
@@ -1,52 +0,0 @@
1
- 'use strict';
2
- const Database = require('../.');
3
-
4
- describe('Database#unsafeMode()', function () {
5
- beforeEach(function () {
6
- this.db = new Database(util.next());
7
- this.db.exec('create table foo (x)');
8
- this.read = this.db.prepare('select 5');
9
- this.write = this.db.prepare('insert into foo values (0)');
10
- });
11
- afterEach(function () {
12
- this.db.close();
13
- });
14
-
15
- it('should not allow unsafe operations by default', function () {
16
- let hadRow = false;
17
- for (const row of this.read.iterate()) {
18
- expect(() => this.write.run()).to.throw(TypeError);
19
- expect(() => this.db.exec('select 5')).to.throw(TypeError);
20
- expect(() => this.db.pragma('cache_size')).to.throw(TypeError);
21
- hadRow = true;
22
- }
23
- expect(hadRow).to.be.true;
24
-
25
- this.db.pragma('journal_mode = OFF');
26
- this.db.pragma('writable_schema = ON');
27
- expect(this.db.pragma('journal_mode', { simple: true })).to.equal('delete');
28
- expect(() => this.db.exec("update sqlite_master set name = 'bar' where name = 'foo'")).to.throw(Database.SqliteError);
29
- });
30
- it('should allow unsafe operations when toggled on', function () {
31
- this.db.unsafeMode();
32
-
33
- let hadRow = false;
34
- for (const row of this.read.iterate()) {
35
- this.write.run();
36
- this.db.exec('select 5');
37
- this.db.pragma('cache_size');
38
- hadRow = true;
39
- }
40
- expect(hadRow).to.be.true;
41
-
42
- this.db.pragma('journal_mode = OFF');
43
- this.db.pragma('writable_schema = ON');
44
- expect(this.db.pragma('journal_mode', { simple: true })).to.equal('off');
45
- this.db.exec("update sqlite_master set name = 'bar' where name = 'foo'");
46
-
47
- this.db.unsafeMode(false);
48
- expect(() => this.db.exec("update sqlite_master set name = 'foo' where name = 'bar'")).to.throw(Database.SqliteError);
49
- this.db.unsafeMode(true);
50
- this.db.exec("update sqlite_master set name = 'foo' where name = 'bar'");
51
- });
52
- });
@@ -1,31 +0,0 @@
1
- 'use strict';
2
- const Database = require('../.');
3
-
4
- describe('Encryption using default method (Sqleet)', () => {
5
- afterEach(() => {
6
- this.db.close();
7
- });
8
-
9
- it('should create an encrypted database', () => {
10
- this.db = new Database(util.next());
11
- this.db.pragma(`rekey='passphrase'`);
12
- this.db.prepare('CREATE TABLE user ("name" TEXT)').run();
13
- this.db.prepare("INSERT INTO user (name) VALUES ('octocat')").run();
14
- this.db.prepare('VACUUM').run();
15
- });
16
- it('should not allow access without decryption', () => {
17
- this.db = new Database(util.current());
18
- expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
19
- });
20
- it('should not allow access with an incorrect passphrase', () => {
21
- this.db = new Database(util.current());
22
- this.db.pragma(`key='false_passphrase'`);
23
- expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
24
- });
25
- it('should allow access with the correct passphrase', () => {
26
- this.db = new Database(util.current());
27
- this.db.pragma(`key='passphrase'`);
28
- const stmt = this.db.prepare('SELECT * FROM user');
29
- expect(stmt.get()).to.deep.equal({name: 'octocat'});
30
- });
31
- });
package/test/50.misc.js DELETED
@@ -1,44 +0,0 @@
1
- 'use strict';
2
- const Database = require('../.');
3
-
4
- describe('miscellaneous', function () {
5
- beforeEach(function () {
6
- this.db = new Database(util.next());
7
- });
8
- afterEach(function () {
9
- this.db.close();
10
- });
11
-
12
- it('persists non-trivial quantities of reads and writes', function () {
13
- const runDuration = 1000;
14
- const runUntil = Date.now() + runDuration;
15
- this.slow(runDuration * 10);
16
- this.timeout(runDuration * 3);
17
- this.db.pragma("journal_mode = WAL");
18
- this.db.prepare("CREATE TABLE foo (a INTEGER, b TEXT, c REAL)").run();
19
-
20
- let i = 1;
21
- const r = 0.141592654;
22
- const insert = this.db.prepare("INSERT INTO foo VALUES (?, ?, ?)");
23
- const insertMany = this.db.transaction((count) => {
24
- for (const end = i + count; i < end; ++i) {
25
- expect(insert.run(i, String(i), i + r))
26
- .to.deep.equal({ changes: 1, lastInsertRowid: i });
27
- }
28
- });
29
-
30
- // Batched transactions of 100 inserts.
31
- while (Date.now() < runUntil) insertMany(100);
32
-
33
- // Expect 10K~50K on reasonable machines.
34
- expect(i).to.be.above(1000);
35
-
36
- const select = this.db.prepare("SELECT * FROM foo ORDER BY a DESC");
37
- for (const row of select.iterate()) {
38
- i -= 1;
39
- expect(row).to.deep.equal({ a: i, b: String(i), c: i + r });
40
- }
41
-
42
- expect(i).to.equal(1);
43
- });
44
- });