sqlmath 0.0.1 → 2021.11.20

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 (96) hide show
  1. package/.npmignore +10 -0
  2. package/CHANGELOG.md +53 -2
  3. package/LICENSE +16 -22
  4. package/README.md +18 -219
  5. package/_binary_sqlmath_napi8_darwin_x64.node +0 -0
  6. package/_binary_sqlmath_napi8_linux_x64.node +0 -0
  7. package/_binary_sqlmath_napi8_win32_x64.node +0 -0
  8. package/jslint.mjs +10998 -0
  9. package/package.json +23 -8
  10. package/sqlmath.mjs +1713 -0
  11. package/.gitconfig +0 -25
  12. package/.github/workflows/ci.yml +0 -61
  13. package/.gitignore +0 -24
  14. package/extension-functions.c +0 -2047
  15. package/jslint_ci.sh +0 -1968
  16. package/node_sqlite3.cc +0 -11877
  17. package/sqlite-autoconf-3360000/INSTALL +0 -370
  18. package/sqlite-autoconf-3360000/Makefile.am +0 -20
  19. package/sqlite-autoconf-3360000/Makefile.fallback +0 -19
  20. package/sqlite-autoconf-3360000/Makefile.in +0 -1028
  21. package/sqlite-autoconf-3360000/Makefile.msc +0 -1037
  22. package/sqlite-autoconf-3360000/README.txt +0 -113
  23. package/sqlite-autoconf-3360000/Replace.cs +0 -223
  24. package/sqlite-autoconf-3360000/aclocal.m4 +0 -10199
  25. package/sqlite-autoconf-3360000/compile +0 -347
  26. package/sqlite-autoconf-3360000/config.guess +0 -1480
  27. package/sqlite-autoconf-3360000/config.sub +0 -1801
  28. package/sqlite-autoconf-3360000/configure +0 -16135
  29. package/sqlite-autoconf-3360000/configure.ac +0 -285
  30. package/sqlite-autoconf-3360000/depcomp +0 -791
  31. package/sqlite-autoconf-3360000/install-sh +0 -508
  32. package/sqlite-autoconf-3360000/ltmain.sh +0 -11156
  33. package/sqlite-autoconf-3360000/missing +0 -215
  34. package/sqlite-autoconf-3360000/shell.c +0 -22381
  35. package/sqlite-autoconf-3360000/sqlite3.1 +0 -286
  36. package/sqlite-autoconf-3360000/sqlite3.c +0 -235517
  37. package/sqlite-autoconf-3360000/sqlite3.h +0 -12353
  38. package/sqlite-autoconf-3360000/sqlite3.pc.in +0 -13
  39. package/sqlite-autoconf-3360000/sqlite3.rc +0 -83
  40. package/sqlite-autoconf-3360000/sqlite3ext.h +0 -663
  41. package/sqlite-autoconf-3360000/sqlite3rc.h +0 -3
  42. package/sqlite-autoconf-3360000/tea/Makefile.in +0 -440
  43. package/sqlite-autoconf-3360000/tea/README +0 -36
  44. package/sqlite-autoconf-3360000/tea/aclocal.m4 +0 -9
  45. package/sqlite-autoconf-3360000/tea/configure +0 -9989
  46. package/sqlite-autoconf-3360000/tea/configure.ac +0 -201
  47. package/sqlite-autoconf-3360000/tea/doc/sqlite3.n +0 -15
  48. package/sqlite-autoconf-3360000/tea/generic/tclsqlite3.c +0 -4016
  49. package/sqlite-autoconf-3360000/tea/license.terms +0 -6
  50. package/sqlite-autoconf-3360000/tea/pkgIndex.tcl.in +0 -7
  51. package/sqlite-autoconf-3360000/tea/tclconfig/install-sh +0 -528
  52. package/sqlite-autoconf-3360000/tea/tclconfig/tcl.m4 +0 -4168
  53. package/sqlite-autoconf-3360000/tea/win/makefile.vc +0 -419
  54. package/sqlite-autoconf-3360000/tea/win/nmakehlp.c +0 -815
  55. package/sqlite-autoconf-3360000/tea/win/rules.vc +0 -711
  56. package/sqlmath.js +0 -238
  57. package/test/backup.test.js +0 -279
  58. package/test/blob.test.js +0 -54
  59. package/test/cache.test.js +0 -42
  60. package/test/constants.test.js +0 -44
  61. package/test/database_fail.test.js +0 -153
  62. package/test/each.test.js +0 -39
  63. package/test/exec.test.js +0 -39
  64. package/test/extension.test.js +0 -26
  65. package/test/extension_functions.test.js +0 -29
  66. package/test/fts-content.test.js +0 -13
  67. package/test/interrupt.test.js +0 -80
  68. package/test/issue-108.test.js +0 -28
  69. package/test/json.test.js +0 -22
  70. package/test/map.test.js +0 -63
  71. package/test/named_columns.test.js +0 -38
  72. package/test/named_params.test.js +0 -69
  73. package/test/null_error.test.js +0 -41
  74. package/test/nw/.gitignore +0 -3
  75. package/test/nw/Makefile +0 -39
  76. package/test/nw/index.html +0 -14
  77. package/test/nw/package.json +0 -9
  78. package/test/open_close.test.js +0 -187
  79. package/test/other_objects.test.js +0 -98
  80. package/test/parallel_insert.test.js +0 -44
  81. package/test/prepare.test.js +0 -427
  82. package/test/profile.test.js +0 -57
  83. package/test/rerun.test.js +0 -50
  84. package/test/scheduling.test.js +0 -44
  85. package/test/serialization.test.js +0 -104
  86. package/test/support/createdb-electron.js +0 -10
  87. package/test/support/createdb.js +0 -47
  88. package/test/support/elmo.png +0 -0
  89. package/test/support/helper.js +0 -37
  90. package/test/support/script.sql +0 -70
  91. package/test/trace.test.js +0 -67
  92. package/test/unicode.test.js +0 -114
  93. package/test/upsert.test.js +0 -27
  94. package/test/verbose.test.js +0 -60
  95. package/test.js +0 -141
  96. package/test.slr.mjs +0 -212
package/test/nw/Makefile DELETED
@@ -1,39 +0,0 @@
1
- NODE_WEBKIT_VERSION=0.8.4
2
-
3
- all: app.nw
4
-
5
- node_modules/sqlite3:
6
- npm install https://github.com/mapbox/node-sqlite3/tarball/master --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
7
-
8
- rebuild:
9
- cd node_modules/sqlite3 && ./node_modules/.bin/node-pre-gyp rebuild --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
10
-
11
- node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip:
12
- wget https://s3.amazonaws.com/node-webkit/v$(NODE_WEBKIT_VERSION)/node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
13
-
14
- ./node-webkit.app: node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
15
- unzip -o node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
16
-
17
- app.nw: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3
18
- zip app.nw index.html package.json node_modules
19
-
20
- test: ./node-webkit.app app.nw
21
- ./node-webkit.app/Contents/MacOS/node-webkit app.nw
22
-
23
- package: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3
24
- rm -rf node-sqlite-test.app
25
- cp -r ./node-webkit.app node-sqlite-test.app
26
- mkdir ./node-sqlite-test.app/Contents/Resources/app.nw/
27
- cp package.json ./node-sqlite-test.app/Contents/Resources/app.nw/
28
- cp index.html ./node-sqlite-test.app/Contents/Resources/app.nw/
29
- cp -r node_modules/ ./node-sqlite-test.app/Contents/Resources/app.nw/
30
- ./node-sqlite-test.app/Contents/MacOS/node-webkit
31
-
32
- clean:
33
- rm -rf ./node_modules/sqlite3
34
- rm -f ./app.nw
35
- rm -rf node-sqlite-test.app
36
- rm -f credits.html
37
- rm -f nwsnapshot
38
-
39
- .PHONY: test
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Hello World!</title>
5
- </head>
6
- <body>
7
- <h1>Hello World!</h1>
8
- Using node-sqlite3:
9
- <script>
10
- var sqlite = require('sqlite3');
11
- document.write(sqlite.VERSION);
12
- </script>.
13
- </body>
14
- </html>
@@ -1,9 +0,0 @@
1
- {
2
- "name": "nw-demo",
3
- "main": "index.html",
4
- "window": {
5
- "toolbar": false,
6
- "width": 800,
7
- "height": 600
8
- }
9
- }
@@ -1,187 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
- var fs = require("fs");
4
- var helper = require("./support/helper");
5
-
6
- describe("open/close", function() {
7
- before(function() {
8
- helper.ensureExists("test/tmp");
9
- });
10
-
11
- describe("open and close non-existant database", function() {
12
- before(function() {
13
- helper.deleteFile("test/tmp/test_create.db");
14
- });
15
-
16
- var db;
17
- it("should open the database", function(done) {
18
- db = new sqlite3.Database("test/tmp/test_create.db", done);
19
- });
20
-
21
- it("should close the database", function(done) {
22
- db.close(done);
23
- });
24
-
25
- it("should have created the file", function() {
26
- assert.fileExists("test/tmp/test_create.db");
27
- });
28
-
29
- after(function() {
30
- helper.deleteFile("test/tmp/test_create.db");
31
- });
32
- });
33
-
34
- describe("open and close non-existant shared database", function() {
35
- before(function() {
36
- helper.deleteFile("test/tmp/test_create_shared.db");
37
- });
38
-
39
- var db;
40
- it("should open the database", function(done) {
41
- db = new sqlite3.Database("file:./test/tmp/test_create_shared.db", sqlite3.OPEN_URI | sqlite3.OPEN_SHAREDCACHE | sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, done);
42
- });
43
-
44
- it("should close the database", function(done) {
45
- db.close(done);
46
- });
47
-
48
- it("should have created the file", function() {
49
- assert.fileExists("test/tmp/test_create_shared.db");
50
- });
51
-
52
- after(function() {
53
- helper.deleteFile("test/tmp/test_create_shared.db");
54
- });
55
- });
56
-
57
-
58
- (sqlite3.VERSION_NUMBER < 3008000 ? describe.skip : describe)("open and close shared memory database", function() {
59
-
60
- var db1;
61
- var db2;
62
-
63
- it("should open the first database", function(done) {
64
- db1 = new sqlite3.Database("file:./test/tmp/test_memory.db?mode=memory", sqlite3.OPEN_URI | sqlite3.OPEN_SHAREDCACHE | sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, done);
65
- });
66
-
67
- it("should open the second database", function(done) {
68
- db2 = new sqlite3.Database("file:./test/tmp/test_memory.db?mode=memory", sqlite3.OPEN_URI | sqlite3.OPEN_SHAREDCACHE | sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, done);
69
- });
70
-
71
- it("first database should set the user_version", function(done) {
72
- db1.exec("PRAGMA user_version=42", done);
73
- });
74
-
75
- it("second database should get the user_version", function(done) {
76
- db2.get("PRAGMA user_version", function(err, row) {
77
- if (err) throw err;
78
- assert.equal(row.user_version, 42);
79
- done();
80
- });
81
- });
82
-
83
- it("should close the first database", function(done) {
84
- db1.close(done);
85
- });
86
-
87
- it("should close the second database", function(done) {
88
- db2.close(done);
89
- });
90
- });
91
-
92
- it("should not be unable to open an inaccessible database", function(done) {
93
- // NOTE: test assumes that the user is not allowed to create new files
94
- // in /usr/bin.
95
- var db = new sqlite3.Database("/test/tmp/directory-does-not-exist/test.db", function(err) {
96
- if (err && err.errno === sqlite3.CANTOPEN) {
97
- done();
98
- } else if (err) {
99
- done(err);
100
- } else {
101
- done("Opened database that should be inaccessible");
102
- }
103
- });
104
- });
105
-
106
-
107
- describe("creating database without create flag", function() {
108
- before(function() {
109
- helper.deleteFile("test/tmp/test_readonly.db");
110
- });
111
-
112
- it("should fail to open the database", function(done) {
113
- new sqlite3.Database("tmp/test_readonly.db", sqlite3.OPEN_READONLY, function(err) {
114
- if (err && err.errno === sqlite3.CANTOPEN) {
115
- done();
116
- } else if (err) {
117
- done(err);
118
- } else {
119
- done("Created database without create flag");
120
- }
121
- });
122
- });
123
-
124
- it("should not have created the file", function() {
125
- assert.fileDoesNotExist("test/tmp/test_readonly.db");
126
- });
127
-
128
- after(function() {
129
- helper.deleteFile("test/tmp/test_readonly.db");
130
- });
131
- });
132
-
133
- describe("open and close memory database queuing", function() {
134
- var db;
135
- it("should open the database", function(done) {
136
- db = new sqlite3.Database(":memory:", done);
137
- });
138
-
139
- it("should close the database", function(done) {
140
- db.close(done);
141
- });
142
-
143
- it("shouldn't close the database again", function(done) {
144
- db.close(function(err) {
145
- assert.ok(err, "No error object received on second close");
146
- assert.ok(err.errno === sqlite3.MISUSE);
147
- done();
148
- });
149
- });
150
- });
151
-
152
- describe("closing with unfinalized statements", function(done) {
153
- var completed = false;
154
- var completedSecond = false;
155
- var closed = false;
156
-
157
- var db;
158
- before(function() {
159
- db = new sqlite3.Database(":memory:", done);
160
- });
161
-
162
- it("should create a table", function(done) {
163
- db.run("CREATE TABLE foo (id INT, num INT)", done);
164
- });
165
-
166
- var stmt;
167
- it("should prepare/run a statement", function(done) {
168
- stmt = db.prepare("INSERT INTO foo VALUES (?, ?)");
169
- stmt.run(1, 2, done);
170
- });
171
-
172
- it("should fail to close the database", function(done) {
173
- db.close(function(err) {
174
- assert.ok(err.message,
175
- "SQLITE_BUSY: unable to close due to unfinalised statements");
176
- done();
177
- });
178
- });
179
-
180
- it("should succeed to close the database after finalizing", function(done) {
181
- stmt.run(3, 4, function() {
182
- stmt.finalize();
183
- db.close(done);
184
- });
185
- });
186
- });
187
- });
@@ -1,98 +0,0 @@
1
- var sqlite3 = require('..');
2
- var assert = require('assert');
3
-
4
- describe('data types', function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database(':memory:');
8
- db.run("CREATE TABLE txt_table (txt TEXT)");
9
- db.run("CREATE TABLE int_table (int INTEGER)");
10
- db.run("CREATE TABLE flt_table (flt FLOAT)");
11
- db.wait(done);
12
- });
13
-
14
- beforeEach(function(done) {
15
- db.exec('DELETE FROM txt_table; DELETE FROM int_table; DELETE FROM flt_table;', done);
16
- });
17
-
18
- it('should serialize Date()', function(done) {
19
- var date = new Date();
20
- db.run("INSERT INTO int_table VALUES(?)", date, function (err) {
21
- if (err) throw err;
22
- db.get("SELECT int FROM int_table", function(err, row) {
23
- if (err) throw err;
24
- assert.equal(row.int, +date);
25
- done();
26
- });
27
- });
28
- });
29
-
30
- it('should serialize RegExp()', function(done) {
31
- var regexp = /^f\noo/;
32
- db.run("INSERT INTO txt_table VALUES(?)", regexp, function (err) {
33
- if (err) throw err;
34
- db.get("SELECT txt FROM txt_table", function(err, row) {
35
- if (err) throw err;
36
- assert.equal(row.txt, String(regexp));
37
- done();
38
- });
39
- });
40
- });
41
-
42
- [
43
- 4294967296.249,
44
- Math.PI,
45
- 3924729304762836.5,
46
- new Date().valueOf(),
47
- 912667.394828365,
48
- 2.3948728634826374e+83,
49
- 9.293476892934982e+300,
50
- Infinity,
51
- -9.293476892934982e+300,
52
- -2.3948728634826374e+83,
53
- -Infinity
54
- ].forEach(function(flt) {
55
- it('should serialize float ' + flt, function(done) {
56
- db.run("INSERT INTO flt_table VALUES(?)", flt, function (err) {
57
- if (err) throw err;
58
- db.get("SELECT flt FROM flt_table", function(err, row) {
59
- if (err) throw err;
60
- assert.equal(row.flt, flt);
61
- done();
62
- });
63
- });
64
- });
65
- });
66
-
67
- [
68
- 4294967299,
69
- 3924729304762836,
70
- new Date().valueOf(),
71
- 2.3948728634826374e+83,
72
- 9.293476892934982e+300,
73
- Infinity,
74
- -9.293476892934982e+300,
75
- -2.3948728634826374e+83,
76
- -Infinity
77
- ].forEach(function(integer) {
78
- it('should serialize integer ' + integer, function(done) {
79
- db.run("INSERT INTO int_table VALUES(?)", integer, function (err) {
80
- if (err) throw err;
81
- db.get("SELECT int AS integer FROM int_table", function(err, row) {
82
- if (err) throw err;
83
- assert.equal(row.integer, integer);
84
- done();
85
- });
86
- });
87
- });
88
- });
89
-
90
- it('should ignore faulty toString', function(done) {
91
- const faulty = { toString: 23 };
92
- db.run("INSERT INTO txt_table VALUES(?)", faulty, function (err) {
93
- assert.notEqual(err, undefined);
94
- done();
95
- });
96
- });
97
-
98
- });
@@ -1,44 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
- var helper = require("./support/helper");
4
-
5
- describe("parallel", function() {
6
- var db;
7
- before(function(done) {
8
- helper.deleteFile("test/tmp/test_parallel_inserts.db");
9
- helper.ensureExists("test/tmp");
10
- db = new sqlite3.Database("test/tmp/test_parallel_inserts.db", done);
11
- });
12
-
13
- var columns = [];
14
- for (var i = 0; i < 128; i++) {
15
- columns.push("id" + i);
16
- }
17
-
18
- it("should create the table", function(done) {
19
- db.run("CREATE TABLE foo (" + columns + ")", done);
20
- });
21
-
22
- it("should insert in parallel", function(done) {
23
- for (var i = 0; i < 1000; i++) {
24
- for (var values = [], j = 0; j < columns.length; j++) {
25
- values.push(i * j);
26
- }
27
- db.run("INSERT INTO foo VALUES (" + values + ")");
28
- }
29
-
30
- db.wait(done);
31
- });
32
-
33
- it("should close the database", function(done) {
34
- db.close(done);
35
- });
36
-
37
- it("should verify that the database exists", function() {
38
- assert.fileExists("test/tmp/test_parallel_inserts.db");
39
- });
40
-
41
- after(function() {
42
- helper.deleteFile("test/tmp/test_parallel_inserts.db");
43
- });
44
- });