sqlmath 0.0.1 → 0.0.2

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 (100) hide show
  1. package/.gitconfig +2 -2
  2. package/.github/workflows/ci.yml +73 -15
  3. package/.github/workflows/publish.yml +66 -0
  4. package/.gitignore +1 -5
  5. package/CHANGELOG.md +53 -2
  6. package/LICENSE +16 -22
  7. package/README.md +18 -219
  8. package/asset_image_folder_open_solid.svg +1 -0
  9. package/jslint.mjs +10998 -0
  10. package/jslint_ci.sh +1542 -728
  11. package/package.json +23 -8
  12. package/{sqlite-autoconf-3360000/sqlite3.c → sqlite3.c} +13116 -85
  13. package/sqlite3_ext.c +8372 -0
  14. package/{sqlite-autoconf-3360000/shell.c → sqlite3_shell.c} +330 -275
  15. package/sqlmath.mjs +1713 -0
  16. package/sqlmath_base.c +1832 -0
  17. package/sqlmath_custom.c +78 -0
  18. package/sqlmath_custom.cpp +0 -0
  19. package/sqlmath_custom.mjs +4 -0
  20. package/sqlmath_old.js +31038 -0
  21. package/extension-functions.c +0 -2047
  22. package/node_sqlite3.cc +0 -11877
  23. package/sqlite-autoconf-3360000/INSTALL +0 -370
  24. package/sqlite-autoconf-3360000/Makefile.am +0 -20
  25. package/sqlite-autoconf-3360000/Makefile.fallback +0 -19
  26. package/sqlite-autoconf-3360000/Makefile.in +0 -1028
  27. package/sqlite-autoconf-3360000/Makefile.msc +0 -1037
  28. package/sqlite-autoconf-3360000/README.txt +0 -113
  29. package/sqlite-autoconf-3360000/Replace.cs +0 -223
  30. package/sqlite-autoconf-3360000/aclocal.m4 +0 -10199
  31. package/sqlite-autoconf-3360000/compile +0 -347
  32. package/sqlite-autoconf-3360000/config.guess +0 -1480
  33. package/sqlite-autoconf-3360000/config.sub +0 -1801
  34. package/sqlite-autoconf-3360000/configure +0 -16135
  35. package/sqlite-autoconf-3360000/configure.ac +0 -285
  36. package/sqlite-autoconf-3360000/depcomp +0 -791
  37. package/sqlite-autoconf-3360000/install-sh +0 -508
  38. package/sqlite-autoconf-3360000/ltmain.sh +0 -11156
  39. package/sqlite-autoconf-3360000/missing +0 -215
  40. package/sqlite-autoconf-3360000/sqlite3.1 +0 -286
  41. package/sqlite-autoconf-3360000/sqlite3.h +0 -12353
  42. package/sqlite-autoconf-3360000/sqlite3.pc.in +0 -13
  43. package/sqlite-autoconf-3360000/sqlite3.rc +0 -83
  44. package/sqlite-autoconf-3360000/sqlite3ext.h +0 -663
  45. package/sqlite-autoconf-3360000/sqlite3rc.h +0 -3
  46. package/sqlite-autoconf-3360000/tea/Makefile.in +0 -440
  47. package/sqlite-autoconf-3360000/tea/README +0 -36
  48. package/sqlite-autoconf-3360000/tea/aclocal.m4 +0 -9
  49. package/sqlite-autoconf-3360000/tea/configure +0 -9989
  50. package/sqlite-autoconf-3360000/tea/configure.ac +0 -201
  51. package/sqlite-autoconf-3360000/tea/doc/sqlite3.n +0 -15
  52. package/sqlite-autoconf-3360000/tea/generic/tclsqlite3.c +0 -4016
  53. package/sqlite-autoconf-3360000/tea/license.terms +0 -6
  54. package/sqlite-autoconf-3360000/tea/pkgIndex.tcl.in +0 -7
  55. package/sqlite-autoconf-3360000/tea/tclconfig/install-sh +0 -528
  56. package/sqlite-autoconf-3360000/tea/tclconfig/tcl.m4 +0 -4168
  57. package/sqlite-autoconf-3360000/tea/win/makefile.vc +0 -419
  58. package/sqlite-autoconf-3360000/tea/win/nmakehlp.c +0 -815
  59. package/sqlite-autoconf-3360000/tea/win/rules.vc +0 -711
  60. package/sqlmath.js +0 -238
  61. package/test/backup.test.js +0 -279
  62. package/test/blob.test.js +0 -54
  63. package/test/cache.test.js +0 -42
  64. package/test/constants.test.js +0 -44
  65. package/test/database_fail.test.js +0 -153
  66. package/test/each.test.js +0 -39
  67. package/test/exec.test.js +0 -39
  68. package/test/extension.test.js +0 -26
  69. package/test/extension_functions.test.js +0 -29
  70. package/test/fts-content.test.js +0 -13
  71. package/test/interrupt.test.js +0 -80
  72. package/test/issue-108.test.js +0 -28
  73. package/test/json.test.js +0 -22
  74. package/test/map.test.js +0 -63
  75. package/test/named_columns.test.js +0 -38
  76. package/test/named_params.test.js +0 -69
  77. package/test/null_error.test.js +0 -41
  78. package/test/nw/.gitignore +0 -3
  79. package/test/nw/Makefile +0 -39
  80. package/test/nw/index.html +0 -14
  81. package/test/nw/package.json +0 -9
  82. package/test/open_close.test.js +0 -187
  83. package/test/other_objects.test.js +0 -98
  84. package/test/parallel_insert.test.js +0 -44
  85. package/test/prepare.test.js +0 -427
  86. package/test/profile.test.js +0 -57
  87. package/test/rerun.test.js +0 -50
  88. package/test/scheduling.test.js +0 -44
  89. package/test/serialization.test.js +0 -104
  90. package/test/support/createdb-electron.js +0 -10
  91. package/test/support/createdb.js +0 -47
  92. package/test/support/elmo.png +0 -0
  93. package/test/support/helper.js +0 -37
  94. package/test/support/script.sql +0 -70
  95. package/test/trace.test.js +0 -67
  96. package/test/unicode.test.js +0 -114
  97. package/test/upsert.test.js +0 -27
  98. package/test/verbose.test.js +0 -60
  99. package/test.js +0 -141
  100. package/test.slr.mjs +0 -212
@@ -1,153 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("error handling", function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database(":memory:", done);
8
- });
9
-
10
- it("throw when calling Database() without new", function() {
11
- assert.throws(function() {
12
- sqlite3.Database(":memory:");
13
- }, (/Class constructors cannot be invoked without 'new'/));
14
-
15
- assert.throws(function() {
16
- sqlite3.Statement();
17
- }, (/Class constructors cannot be invoked without 'new'/));
18
- });
19
-
20
- it("should error when calling Database#get on a missing table", function(done) {
21
- db.get("SELECT id, txt FROM foo", function(err, row) {
22
- if (err) {
23
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
24
- assert.equal(err.errno, sqlite3.ERROR);
25
- assert.equal(err.code, "SQLITE_ERROR");
26
- done();
27
- } else {
28
- done(new Error("Completed query without error, but expected error"));
29
- }
30
- });
31
- });
32
-
33
- it("Database#all prepare fail", function(done) {
34
- db.all("SELECT id, txt FROM foo", function(err, row) {
35
- if (err) {
36
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
37
- assert.equal(err.errno, sqlite3.ERROR);
38
- assert.equal(err.code, "SQLITE_ERROR");
39
- done();
40
- } else {
41
- done(new Error("Completed query without error, but expected error"));
42
- }
43
- });
44
- });
45
-
46
- it("Database#run prepare fail", function(done) {
47
- db.run("SELECT id, txt FROM foo", function(err, row) {
48
- if (err) {
49
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
50
- assert.equal(err.errno, sqlite3.ERROR);
51
- assert.equal(err.code, "SQLITE_ERROR");
52
- done();
53
- } else {
54
- done(new Error("Completed query without error, but expected error"));
55
- }
56
- });
57
- });
58
-
59
- it("Database#each prepare fail", function(done) {
60
- db.each("SELECT id, txt FROM foo", function(err, row) {
61
- assert.ok(false, "this should not be called");
62
- }, function(err, num) {
63
- if (err) {
64
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
65
- assert.equal(err.errno, sqlite3.ERROR);
66
- assert.equal(err.code, "SQLITE_ERROR");
67
- done();
68
- } else {
69
- done(new Error("Completed query without error, but expected error"));
70
- }
71
- });
72
- });
73
-
74
- it("Database#each prepare fail without completion handler", function(done) {
75
- db.each("SELECT id, txt FROM foo", function(err, row) {
76
- if (err) {
77
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
78
- assert.equal(err.errno, sqlite3.ERROR);
79
- assert.equal(err.code, "SQLITE_ERROR");
80
- done();
81
- } else {
82
- done(new Error("Completed query without error, but expected error"));
83
- }
84
- });
85
- });
86
-
87
- it("Database#get prepare fail with param binding", function(done) {
88
- db.get("SELECT id, txt FROM foo WHERE id = ?", 1, function(err, row) {
89
- if (err) {
90
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
91
- assert.equal(err.errno, sqlite3.ERROR);
92
- assert.equal(err.code, "SQLITE_ERROR");
93
- done();
94
- } else {
95
- done(new Error("Completed query without error, but expected error"));
96
- }
97
- });
98
- });
99
-
100
- it("Database#all prepare fail with param binding", function(done) {
101
- db.all("SELECT id, txt FROM foo WHERE id = ?", 1, function(err, row) {
102
- if (err) {
103
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
104
- assert.equal(err.errno, sqlite3.ERROR);
105
- assert.equal(err.code, "SQLITE_ERROR");
106
- done();
107
- } else {
108
- done(new Error("Completed query without error, but expected error"));
109
- }
110
- });
111
- });
112
-
113
- it("Database#run prepare fail with param binding", function(done) {
114
- db.run("SELECT id, txt FROM foo WHERE id = ?", 1, function(err, row) {
115
- if (err) {
116
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
117
- assert.equal(err.errno, sqlite3.ERROR);
118
- assert.equal(err.code, "SQLITE_ERROR");
119
- done();
120
- } else {
121
- done(new Error("Completed query without error, but expected error"));
122
- }
123
- });
124
- });
125
-
126
- it("Database#each prepare fail with param binding", function(done) {
127
- db.each("SELECT id, txt FROM foo WHERE id = ?", 1, function(err, row) {
128
- assert.ok(false, "this should not be called");
129
- }, function(err, num) {
130
- if (err) {
131
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
132
- assert.equal(err.errno, sqlite3.ERROR);
133
- assert.equal(err.code, "SQLITE_ERROR");
134
- done();
135
- } else {
136
- done(new Error("Completed query without error, but expected error"));
137
- }
138
- });
139
- });
140
-
141
- it("Database#each prepare fail with param binding without completion handler", function(done) {
142
- db.each("SELECT id, txt FROM foo WHERE id = ?", 1, function(err, row) {
143
- if (err) {
144
- assert.equal(err.message, "SQLITE_ERROR: no such table: foo");
145
- assert.equal(err.errno, sqlite3.ERROR);
146
- assert.equal(err.code, "SQLITE_ERROR");
147
- done();
148
- } else {
149
- done(new Error("Completed query without error, but expected error"));
150
- }
151
- });
152
- });
153
- });
package/test/each.test.js DELETED
@@ -1,39 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("each", function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database("test/support/big.db", sqlite3.OPEN_READONLY, done);
8
- });
9
-
10
- it("retrieve 100,000 rows with Statement#each", function(done) {
11
- var total = 100000;
12
- var retrieved = 0;
13
-
14
-
15
- db.each("SELECT id, txt FROM foo LIMIT 0, ?", total, function(err, row) {
16
- if (err) throw err;
17
- retrieved++;
18
-
19
- if(retrieved === total) {
20
- assert.equal(retrieved, total, "Only retrieved " + retrieved + " out of " + total + " rows.");
21
- done();
22
- }
23
- });
24
- });
25
-
26
- it("Statement#each with complete callback", function(done) {
27
- var total = 10000;
28
- var retrieved = 0;
29
-
30
- db.each("SELECT id, txt FROM foo LIMIT 0, ?", total, function(err, row) {
31
- if (err) throw err;
32
- retrieved++;
33
- }, function(err, num) {
34
- assert.equal(retrieved, num);
35
- assert.equal(retrieved, total, "Only retrieved " + retrieved + " out of " + total + " rows.");
36
- done();
37
- });
38
- });
39
- });
package/test/exec.test.js DELETED
@@ -1,39 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
- var fs = require("fs");
4
-
5
- describe("exec", function() {
6
- var db;
7
- before(function(done) {
8
- db = new sqlite3.Database(":memory:", done);
9
- });
10
-
11
- it("Database#exec", function(done) {
12
- var sql = fs.readFileSync("test/support/script.sql", "utf8");
13
- db.exec(sql, done);
14
- });
15
-
16
- it("retrieve database structure", function(done) {
17
- db.all("SELECT type, name FROM sqlite_master ORDER BY type, name", function(err, rows) {
18
- if (err) throw err;
19
- assert.deepEqual(rows, [
20
- { type: "index", name: "grid_key_lookup" },
21
- { type: "index", name: "grid_utfgrid_lookup" },
22
- { type: "index", name: "images_id" },
23
- { type: "index", name: "keymap_lookup" },
24
- { type: "index", name: "map_index" },
25
- { type: "index", name: "name" },
26
- { type: "table", name: "grid_key" },
27
- { type: "table", name: "grid_utfgrid" },
28
- { type: "table", name: "images" },
29
- { type: "table", name: "keymap" },
30
- { type: "table", name: "map" },
31
- { type: "table", name: "metadata" },
32
- { type: "view", name: "grid_data" },
33
- { type: "view", name: "grids" },
34
- { type: "view", name: "tiles" }
35
- ]);
36
- done();
37
- });
38
- });
39
- });
@@ -1,26 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
- var exists = require("fs").existsSync || require("path").existsSync;
4
-
5
- /*
6
-
7
- // disabled because this is not a generically safe test to run on all systems
8
-
9
- var spatialite_ext = '/usr/local/lib/libspatialite.dylib';
10
-
11
- describe('loadExtension', function(done) {
12
- var db;
13
- before(function(done) {
14
- db = new sqlite3.Database(':memory:', done);
15
- });
16
-
17
- if (exists(spatialite_ext)) {
18
- it('libspatialite', function(done) {
19
- db.loadExtension(spatialite_ext, done);
20
- });
21
- } else {
22
- it('libspatialite');
23
- }
24
- });
25
-
26
- */
@@ -1,29 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- if( process.env.NODE_SQLITE3_JSON1 === "no" ){
5
- describe("extension_functions", function() {
6
- it(
7
- "skips extension_functions tests when --sqlite=/usr (or similar) is tested",
8
- function(){}
9
- );
10
- });
11
- } else {
12
- describe("extension_functions", function() {
13
- var db;
14
-
15
- before(function(done) {
16
- db = new sqlite3.Database(":memory:", done);
17
- });
18
-
19
- it("should select atn2(0, 1) as 0", function(done) {
20
- db.all("SELECT ATN2(0, 1) AS val", function(err, rows) {
21
- if (err) {
22
- throw err;
23
- }
24
- assert.equal(rows[0].val, 0);
25
- done();
26
- });
27
- });
28
- });
29
- }
@@ -1,13 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("fts", function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database(":memory:", done);
8
- });
9
-
10
- it("should create a new fts4 table", function(done) {
11
- db.exec("CREATE VIRTUAL TABLE t1 USING fts4(content=\"\", a, b, c);", done);
12
- });
13
- });
@@ -1,80 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("interrupt", function() {
5
- it("should interrupt queries", function(done) {
6
- var interrupted = false;
7
- var saved = null;
8
-
9
- var db = new sqlite3.Database(":memory:", function() {
10
- db.serialize();
11
-
12
- var setup = "create table t (n int);";
13
- for (var i = 0; i < 8; i += 1) {
14
- setup += "insert into t values (" + i + ");";
15
- }
16
-
17
- db.exec(setup, function(err) {
18
- if (err) {
19
- return done(err);
20
- }
21
-
22
- var query = "select last.n " +
23
- "from t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t as last";
24
-
25
- db.each(query, function(err) {
26
- if (err) {
27
- saved = err;
28
- } else if (!interrupted) {
29
- interrupted = true;
30
- db.interrupt();
31
- }
32
- });
33
-
34
- db.close(function() {
35
- if (saved) {
36
- assert.equal(saved.message, "SQLITE_INTERRUPT: interrupted");
37
- assert.equal(saved.errno, sqlite3.INTERRUPT);
38
- assert.equal(saved.code, "SQLITE_INTERRUPT");
39
- done();
40
- } else {
41
- done(new Error("Completed query without error, but expected error"));
42
- }
43
- });
44
- });
45
- });
46
- });
47
-
48
- it("should throw if interrupt is called before open", function(done) {
49
- var db = new sqlite3.Database(":memory:");
50
-
51
- assert.throws(function() {
52
- db.interrupt();
53
- }, (/Database is not open/));
54
-
55
- db.close();
56
- done();
57
- });
58
-
59
- it("should throw if interrupt is called after close", function(done) {
60
- var db = new sqlite3.Database(":memory:");
61
-
62
- db.close(function() {
63
- assert.throws(function() {
64
- db.interrupt();
65
- }, (/Database is not open/));
66
-
67
- done();
68
- });
69
- });
70
-
71
- it("should throw if interrupt is called during close", function(done) {
72
- var db = new sqlite3.Database(":memory:", function() {
73
- db.close();
74
- assert.throws(function() {
75
- db.interrupt();
76
- }, (/Database is closing/));
77
- done();
78
- });
79
- });
80
- });
@@ -1,28 +0,0 @@
1
- var sqlite3 = require(".."),
2
- assert = require("assert");
3
-
4
- describe("buffer", function() {
5
- var db;
6
- // before(function() {
7
- // });
8
-
9
- it("should insert blobs", function(done) {
10
- db = new sqlite3.Database(":memory:");
11
- db.serialize(function () {
12
-
13
- db.run("CREATE TABLE lorem (info BLOB)");
14
- var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
15
-
16
- stmt.on("error", function (err) {
17
- throw err;
18
- });
19
-
20
- var buff = new Buffer(2);
21
- stmt.run(buff);
22
- stmt.finalize();
23
- });
24
-
25
- db.close(done);
26
-
27
- });
28
- });
package/test/json.test.js DELETED
@@ -1,22 +0,0 @@
1
- var sqlite3 = require("..");
2
-
3
- if( process.env.NODE_SQLITE3_JSON1 === "no" ){
4
- describe("json", function() {
5
- it(
6
- "skips JSON tests when --sqlite=/usr (or similar) is tested",
7
- function(){}
8
- );
9
- });
10
- } else {
11
- describe("json", function() {
12
- var db;
13
-
14
- before(function(done) {
15
- db = new sqlite3.Database(":memory:", done);
16
- });
17
-
18
- it("should select JSON", function(done) {
19
- db.run("SELECT json(?)", JSON.stringify({ok:true}), done);
20
- });
21
- });
22
- }
package/test/map.test.js DELETED
@@ -1,63 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("map", function() {
5
- it("test Database#map() with two columns", function(done) {
6
- var count = 10;
7
- var inserted = 0;
8
-
9
- var db = new sqlite3.Database(":memory:");
10
- db.serialize(function() {
11
- db.run("CREATE TABLE foo (id INT, value TEXT)");
12
-
13
- var stmt = db.prepare("INSERT INTO foo VALUES(?, ?)");
14
- for (var i = 5; i < count; i++) {
15
- stmt.run(i, "Value for " + i, function(err) {
16
- if (err) throw err;
17
- inserted++;
18
- });
19
- }
20
- stmt.finalize();
21
-
22
- db.map("SELECT * FROM foo", function(err, map) {
23
- if (err) throw err;
24
- assert.deepEqual(map, { 5: "Value for 5", 6: "Value for 6", 7: "Value for 7", 8: "Value for 8", 9: "Value for 9" });
25
- assert.equal(inserted, 5);
26
- done();
27
- });
28
- });
29
- });
30
-
31
- it("test Database#map() with three columns", function(done) {
32
- var db = new sqlite3.Database(":memory:");
33
-
34
- var count = 10;
35
- var inserted = 0;
36
-
37
- db.serialize(function() {
38
- db.run("CREATE TABLE foo (id INT, value TEXT, other TEXT)");
39
-
40
- var stmt = db.prepare("INSERT INTO foo VALUES(?, ?, ?)");
41
- for (var i = 5; i < count; i++) {
42
- stmt.run(i, "Value for " + i, null, function(err) {
43
- if (err) throw err;
44
- inserted++;
45
- });
46
- }
47
- stmt.finalize();
48
-
49
- db.map("SELECT * FROM foo", function(err, map) {
50
- if (err) throw err;
51
- assert.deepEqual(map, {
52
- 5: { id: 5, value: "Value for 5", other: null },
53
- 6: { id: 6, value: "Value for 6", other: null },
54
- 7: { id: 7, value: "Value for 7", other: null },
55
- 8: { id: 8, value: "Value for 8", other: null },
56
- 9: { id: 9, value: "Value for 9", other: null }
57
- });
58
- assert.equal(inserted, 5);
59
- done();
60
- });
61
- });
62
- });
63
- });
@@ -1,38 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("named columns", function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database(":memory:", done);
8
- });
9
-
10
- it("should create the table", function(done) {
11
- db.run("CREATE TABLE foo (txt TEXT, num INT)", done);
12
- });
13
-
14
- it("should insert a value", function(done) {
15
- db.run("INSERT INTO foo VALUES($text, $id)", {
16
- $id: 1,
17
- $text: "Lorem Ipsum"
18
- }, done);
19
- });
20
-
21
- it("should retrieve the values", function(done) {
22
- db.get("SELECT txt, num FROM foo ORDER BY num", function(err, row) {
23
- if (err) throw err;
24
- assert.equal(row.txt, "Lorem Ipsum");
25
- assert.equal(row.num, 1);
26
- done();
27
- });
28
- });
29
-
30
- it("should be able to retrieve rowid of last inserted value", function(done) {
31
- db.get("SELECT last_insert_rowid() as last_id FROM foo", function(err, row) {
32
- if (err) throw err;
33
- assert.equal(row.last_id, 1);
34
- done();
35
- });
36
- });
37
-
38
- });
@@ -1,69 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
-
4
- describe("named parameters", function() {
5
- var db;
6
- before(function(done) {
7
- db = new sqlite3.Database(":memory:", done);
8
- });
9
-
10
- it("should create the table", function(done) {
11
- db.run("CREATE TABLE foo (txt TEXT, num INT)", done);
12
- });
13
-
14
- it("should insert a value with $ placeholders", function(done) {
15
- db.run("INSERT INTO foo VALUES($text, $id)", {
16
- $id: 1,
17
- $text: "Lorem Ipsum"
18
- }, done);
19
- });
20
-
21
- it("should insert a value with : placeholders", function(done) {
22
- db.run("INSERT INTO foo VALUES(:text, :id)", {
23
- ":id": 2,
24
- ":text": "Dolor Sit Amet"
25
- }, done);
26
- });
27
-
28
- it("should insert a value with @ placeholders", function(done) {
29
- db.run("INSERT INTO foo VALUES(@txt, @id)", {
30
- "@id": 3,
31
- "@txt": "Consectetur Adipiscing Elit"
32
- }, done);
33
- });
34
-
35
- it("should insert a value with @ placeholders using an array", function(done) {
36
- db.run("INSERT INTO foo VALUES(@txt, @id)", [ "Sed Do Eiusmod", 4 ], done);
37
- });
38
-
39
- it("should insert a value with indexed placeholders", function(done) {
40
- db.run("INSERT INTO foo VALUES(?2, ?4)",
41
- [ null, "Tempor Incididunt", null, 5 ], done);
42
- });
43
-
44
- it("should insert a value with autoindexed placeholders", function(done) {
45
- db.run("INSERT INTO foo VALUES(?, ?)", {
46
- 2: 6,
47
- 1: "Ut Labore Et Dolore"
48
- }, done);
49
- });
50
-
51
- it("should retrieve all inserted values", function(done) {
52
- db.all("SELECT txt, num FROM foo ORDER BY num", function(err, rows) {
53
- if (err) throw err;
54
- assert.equal(rows[0].txt, "Lorem Ipsum");
55
- assert.equal(rows[0].num, 1);
56
- assert.equal(rows[1].txt, "Dolor Sit Amet");
57
- assert.equal(rows[1].num, 2);
58
- assert.equal(rows[2].txt, "Consectetur Adipiscing Elit");
59
- assert.equal(rows[2].num, 3);
60
- assert.equal(rows[3].txt, "Sed Do Eiusmod");
61
- assert.equal(rows[3].num, 4);
62
- assert.equal(rows[4].txt, "Tempor Incididunt");
63
- assert.equal(rows[4].num, 5);
64
- assert.equal(rows[5].txt, "Ut Labore Et Dolore");
65
- assert.equal(rows[5].num, 6);
66
- done();
67
- });
68
- });
69
- });
@@ -1,41 +0,0 @@
1
- var sqlite3 = require("..");
2
- var assert = require("assert");
3
- var helper = require("./support/helper");
4
-
5
- describe("null error", function() {
6
- var filename = "test/tmp/test_sqlite_ok_error.db";
7
- var db;
8
-
9
- before(function(done) {
10
- helper.ensureExists("test/tmp");
11
- helper.deleteFile(filename);
12
- db = new sqlite3.Database(filename, done);
13
- });
14
-
15
- it("should create a table", function(done) {
16
- db.run("CREATE TABLE febp_data (leacode TEXT, leaname TEXT, state TEXT, postcode TEXT, fips TEXT, titleistim TEXT, ideastim TEXT, ideapool TEXT, ideapoolname TEXT, localebasis TEXT, localetype2 TEXT, version TEXT, leacount_2006 TEXT, ppexpend_2005 TEXT, ppexpend_2006 TEXT, ppexpend_2007 TEXT, ppexpend_2008 TEXT, ppexpendrank_2006 TEXT, ppexpendrank_2007 TEXT, ppexpendrank_2008 TEXT, rankppexpend_2005 TEXT, opbud_2004 TEXT, opbud_2006 TEXT, opbud_2007 TEXT, opbud_2008 TEXT, titlei_2004 TEXT, titlei_2006 TEXT, titlei_2007 TEXT, titlei_2008 TEXT, titlei_2009 TEXT, titlei_2010 TEXT, idea_2004 TEXT, idea_2005 TEXT, idea_2006 TEXT, idea_2007 TEXT, idea_2008 TEXT, idea_2009 TEXT, ideaest_2010 TEXT, impact_2007 TEXT, impact_2008 TEXT, impact_2009 TEXT, impact_2010 TEXT, fedrev_2006 TEXT, fedrev_2007 TEXT, fedrev_2008 TEXT, schonut_2006 TEXT, schonut_2007 TEXT, schomeal_2006 TEXT, schomeal_2007 TEXT, schoco_2006 TEXT, schocom_2007 TEXT, medicaid_2006 TEXT, medicaid_2007 TEXT, medicaid_2008 TEXT, cenpov_2004 TEXT, cenpov_2007 TEXT, cenpov_2008 TEXT, rankcenpov_2004 TEXT, rankcenpov_2007 TEXT, rankcenpov_2008 TEXT, enroll_2006 TEXT, enroll_2007 TEXT, enroll_2008 TEXT, white_2006 TEXT, white_2007 TEXT, white_2008 TEXT, afam_2006 TEXT, afam_2007 TEXT, afam_2008 TEXT, amin_2006 TEXT, amin_2007 TEXT, amin_2008 TEXT, asian_2006 TEXT, asian_2007 TEXT, asian_2008 TEXT, hisp_2006 TEXT, hisp_2007 TEXT, hisp_2008 TEXT, frpl_2006 TEXT, frpl_2007 TEXT, frpl_2008 TEXT, ell_2006 TEXT, ell_2007 TEXT, ell_2008 TEXT, sped_2006 TEXT, sped_2007 TEXT, sped_2008 TEXT, state4read_2005 TEXT, state4read_2006 TEXT, state4read_2007 TEXT, state4read_2008 TEXT, state4read_2009 TEXT, state4math_2005 TEXT, state4math_2006 TEXT, state4math_2007 TEXT, state4math_2008 TEXT, state4math_2009 TEXT, minor_2007 TEXT, minor_2008 TEXT, state8math_2006 TEXT, state8math_2007 TEXT, state8math_2008 TEXT, state8math_2009 TEXT, state8read_2006 TEXT, state8read_2007 TEXT, state8read_2008 TEXT, state8read_2009 TEXT, statehsmath_2006 TEXT, statehsmath_2007 TEXT, statehsmath_2008 TEXT, statehsmath_2009 TEXT, statehsread_2006 TEXT, statehsread_2007 TEXT, statehsread_2008 TEXT, statehsread_2009 TEXT)", done);
17
- });
18
-
19
- it("should insert rows with lots of null values", function(done) {
20
- var stmt = db.prepare("INSERT INTO febp_data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", function(err) {
21
- if (err) throw err;
22
-
23
- for (var i = 0; i < 100; i++) {
24
- stmt.run([ "100005", "Albertville City School District", "ALABAMA", "AL", "1", "856031", "753000", "NULL", "NULL", "6-Small Town", "Town", 21, "130", "6624", "7140", "8731", "8520", "102", "88", "100", "94", "23352000", "27280000", "30106000", "33028000", "768478", "845886", "782696", "1096819", "1279663", "1168521", "561522", "657649", "684366", "687531", "710543", "727276", "726647", "N/A", "N/A", "N/A", "N/A", "986", "977", "1006", "1080250", "1202325", "1009962", "1109310", "70287", "93015", "14693.56", "13634.58", "N/A", "0.230", "0.301", "0.268882175", "73", "26", "29", "3718", "3747", "3790", "2663", "2615", "2575", "75", "82", "89", "3", "2", "6", "11", "9", "8", "955", "1028", "1102", "1991", "2061", "2146", "649", "729", "770", "443", "278", "267", "0.860", "0.86", "0.8474", "0.84", "0.8235", "0.810", "0.84", "0.7729", "0.75", "0.7843", "1121", "1205", "0.74", "0.6862", "0.72", "0.7317", "0.78", "0.7766", "0.79", "0.7387", "0.84", "0.9255", "0.86", "0.9302", "0.88", "0.9308", "0.84", "0.8605" ]);
25
- }
26
-
27
- stmt.finalize(function(err) {
28
- if (err) throw err;
29
- done();
30
- });
31
- });
32
- });
33
-
34
- it("should have created the database", function() {
35
- assert.fileExists(filename);
36
- });
37
-
38
- after(function() {
39
- helper.deleteFile(filename);
40
- });
41
- });
@@ -1,3 +0,0 @@
1
- node-webkit.app
2
- node-webkit-v0.8.4-osx-ia32.zip
3
- node_modules