duckdb 0.6.2-dev529.0 → 0.6.2-dev567.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.
- package/.mocharc.json +2 -2
- package/README.md +17 -0
- package/lib/duckdb.d.ts +29 -11
- package/lib/duckdb.js +6 -0
- package/package.json +1 -1
- package/src/duckdb.cpp +4 -0
- package/src/duckdb.hpp +3 -2
- package/src/parquet-amalgamation.cpp +37854 -37854
- package/test/{affected.test.js → affected.test.ts} +8 -10
- package/test/{arrow.test.js → arrow.test.ts} +12 -11
- package/test/{data_type_support.test.js → data_type_support.test.ts} +36 -35
- package/test/{database_fail.test.js → database_fail.test.ts} +25 -24
- package/test/{each.test.js → each.test.ts} +10 -9
- package/test/{exec.test.js → exec.test.ts} +7 -6
- package/test/{extension.test.js → extension.test.ts} +20 -19
- package/test/{interrupt.test.js → interrupt.test.ts} +7 -7
- package/test/{jsdoc.test.js → jsdoc.test.ts} +19 -20
- package/test/{named_columns.test.js → named_columns.test.ts} +4 -6
- package/test/{null_error.test.js → null_error.test.ts} +5 -6
- package/test/{open_close.test.js → open_close.test.ts} +10 -10
- package/test/{parallel_insert.test.js → parallel_insert.test.ts} +6 -7
- package/test/{parquet.js → parquet.test.ts} +2 -4
- package/test/{pathnames.test.js → pathnames.test.ts} +24 -22
- package/test/{prepare.test.js → prepare.test.ts} +53 -50
- package/test/{query_result.test.js → query_result.test.ts} +4 -4
- package/test/{serialization.test.js → serialization.test.ts} +10 -9
- package/test/support/helper.ts +42 -0
- package/test/{syntax_error.test.js → syntax_error.test.ts} +4 -4
- package/test/{udf.test.js → udf.test.ts} +26 -25
- package/test/{unicode.test.js → unicode.test.ts} +23 -22
- package/test/support/helper.js +0 -37
|
@@ -2,46 +2,43 @@
|
|
|
2
2
|
* Intended to be similar to stubtest for python
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import * as duckdb from "..";
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import jsdoc from "jsdoc3-parser";
|
|
7
8
|
const { expect } = require('chai');
|
|
8
9
|
const { promisify } = require('util');
|
|
9
10
|
|
|
10
|
-
function lastDot(string) {
|
|
11
|
+
function lastDot(string: string) {
|
|
11
12
|
if (string.endsWith(')')) {
|
|
12
|
-
string = string.
|
|
13
|
+
string = string.substring(0, string.length - 1);
|
|
13
14
|
}
|
|
14
15
|
const array = string.split('.');
|
|
15
16
|
return array[array.length - 1];
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
export interface Node {
|
|
20
|
+
undocumented: boolean;
|
|
21
|
+
name: string;
|
|
22
|
+
memberof: string;
|
|
23
|
+
longname: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}
|
|
26
26
|
describe("JSDoc contains all methods", () => {
|
|
27
|
-
|
|
28
|
-
* @type {Node[]}
|
|
29
|
-
*/
|
|
30
|
-
let docs;
|
|
27
|
+
let docs: Node[];
|
|
31
28
|
before(async () => {
|
|
32
29
|
docs = await promisify(jsdoc)(require.resolve("../lib/duckdb"));
|
|
33
30
|
})
|
|
34
31
|
|
|
35
|
-
function checkDocs(obj, scope) {
|
|
32
|
+
function checkDocs(obj: object, scope: string) {
|
|
36
33
|
const symbols = Object.getOwnPropertySymbols(obj).map(i => lastDot(i.toString()));
|
|
37
34
|
const expected = Object
|
|
38
35
|
.getOwnPropertyNames(obj)
|
|
39
36
|
.concat(symbols)
|
|
40
37
|
.sort()
|
|
41
|
-
.filter(name => name !== 'constructor');
|
|
38
|
+
.filter(name => name !== 'constructor' && name !== 'default');
|
|
42
39
|
|
|
43
40
|
const actual = docs
|
|
44
|
-
.filter((node) => node.memberof === scope && !node.undocumented)
|
|
41
|
+
.filter((node) => node.memberof === scope && !node.undocumented && node.name !== 'sql') // `sql` is a field, so won't show up in the prototype
|
|
45
42
|
.map((node) => lastDot(node.name))
|
|
46
43
|
.sort();
|
|
47
44
|
|
|
@@ -50,7 +47,9 @@ describe("JSDoc contains all methods", () => {
|
|
|
50
47
|
|
|
51
48
|
for (const clazz of ['Database', 'QueryResult', 'Connection', 'Statement']) {
|
|
52
49
|
it(clazz, () => {
|
|
53
|
-
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
let clazzObj = duckdb[clazz];
|
|
52
|
+
checkDocs(clazzObj.prototype, `module:duckdb~${clazz}`);
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as sqlite3 from '..';
|
|
2
|
+
import * as assert from 'assert';
|
|
3
3
|
|
|
4
4
|
// TODO
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
describe('named columns', function() {
|
|
8
|
-
var db;
|
|
5
|
+
describe.skip('named columns', function() {
|
|
6
|
+
var db: sqlite3.Database;
|
|
9
7
|
before(function(done) {
|
|
10
8
|
db = new sqlite3.Database(':memory:', done);
|
|
11
9
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var helper = require('./support/helper');
|
|
1
|
+
import * as sqlite3 from '..';
|
|
2
|
+
import * as helper from './support/helper';
|
|
4
3
|
|
|
5
4
|
describe('null error', function() {
|
|
6
5
|
var filename = 'test/tmp/test_sqlite_ok_error.db';
|
|
7
|
-
var db;
|
|
6
|
+
var db: sqlite3.Database;
|
|
8
7
|
|
|
9
8
|
before(function(done) {
|
|
10
9
|
helper.ensureExists('test/tmp');
|
|
@@ -17,7 +16,7 @@ describe('null error', function() {
|
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
it('should insert rows with lots of null values', function(done) {
|
|
20
|
-
var stmt = db.prepare('INSERT INTO febp_data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', function(err) {
|
|
19
|
+
var stmt = db.prepare('INSERT INTO febp_data VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', function(err: null | Error) {
|
|
21
20
|
if (err) throw err;
|
|
22
21
|
|
|
23
22
|
for (var i = 0; i < 100; i++) {
|
|
@@ -32,7 +31,7 @@ describe('null error', function() {
|
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
it('should have created the database', function() {
|
|
35
|
-
|
|
34
|
+
helper.fileExists(filename);
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
after(function() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as sqlite3 from '..';
|
|
2
|
+
import * as assert from 'assert';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as helper from './support/helper';
|
|
5
5
|
|
|
6
6
|
describe('open/close', function() {
|
|
7
7
|
before(function() {
|
|
@@ -13,7 +13,7 @@ describe('open/close', function() {
|
|
|
13
13
|
helper.deleteFile('test/tmp/test_create.db');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
var db;
|
|
16
|
+
var db: sqlite3.Database;
|
|
17
17
|
it('should open the database', function(done) {
|
|
18
18
|
db = new sqlite3.Database('test/tmp/test_create.db', done);
|
|
19
19
|
});
|
|
@@ -23,7 +23,7 @@ describe('open/close', function() {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it('should have created the file', function() {
|
|
26
|
-
|
|
26
|
+
helper.fileExists('test/tmp/test_create.db');
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
after(function() {
|
|
@@ -123,7 +123,7 @@ describe('open/close', function() {
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
it('should not have created the file', function() {
|
|
126
|
-
|
|
126
|
+
helper.fileDoesNotExist('test/tmp/test_readonly.db');
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
after(function() {
|
|
@@ -132,7 +132,7 @@ describe('open/close', function() {
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
describe('open and close memory database queuing', function() {
|
|
135
|
-
var db;
|
|
135
|
+
var db: sqlite3.Database;
|
|
136
136
|
it('should open the database', function(done) {
|
|
137
137
|
db = new sqlite3.Database(':memory:', done);
|
|
138
138
|
});
|
|
@@ -155,7 +155,7 @@ describe('open/close', function() {
|
|
|
155
155
|
var completedSecond = false;
|
|
156
156
|
var closed = false;
|
|
157
157
|
|
|
158
|
-
var db;
|
|
158
|
+
var db: sqlite3.Database;
|
|
159
159
|
before(function(done) {
|
|
160
160
|
db = new sqlite3.Database(':memory:', done);
|
|
161
161
|
});
|
|
@@ -164,7 +164,7 @@ describe('open/close', function() {
|
|
|
164
164
|
db.run("CREATE TABLE foo (id INT, num INT)", done);
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
var stmt;
|
|
167
|
+
var stmt: sqlite3.Statement;
|
|
168
168
|
it('should prepare/run a statement', function(done) {
|
|
169
169
|
stmt = db.prepare('INSERT INTO foo VALUES (?, ?)');
|
|
170
170
|
stmt.run(1, 2, done);
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var helper = require('./support/helper');
|
|
1
|
+
import * as sqlite3 from '..';
|
|
2
|
+
import * as helper from './support/helper';
|
|
4
3
|
|
|
5
4
|
describe('parallel', function() {
|
|
6
|
-
var db;
|
|
5
|
+
var db: sqlite3.Database;
|
|
7
6
|
before(function(done) {
|
|
8
7
|
helper.deleteFile('test/tmp/test_parallel_inserts.db');
|
|
9
8
|
helper.ensureExists('test/tmp');
|
|
10
9
|
db = new sqlite3.Database('test/tmp/test_parallel_inserts.db', done);
|
|
11
10
|
});
|
|
12
11
|
|
|
13
|
-
var columns = [];
|
|
12
|
+
var columns: string[] = [];
|
|
14
13
|
for (var i = 0; i < 128; i++) {
|
|
15
14
|
columns.push('id' + i + " INTEGER");
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
it('should create the table', function(done) {
|
|
19
|
-
db.run("CREATE TABLE foo (" + columns + ")", function(err) {
|
|
18
|
+
db.run("CREATE TABLE foo (" + columns + ")", function(err: null | Error) {
|
|
20
19
|
done();
|
|
21
20
|
});
|
|
22
21
|
});
|
|
@@ -37,7 +36,7 @@ describe('parallel', function() {
|
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
it('should verify that the database exists', function() {
|
|
40
|
-
|
|
39
|
+
helper.fileExists('test/tmp/test_parallel_inserts.db');
|
|
41
40
|
});
|
|
42
41
|
|
|
43
42
|
after(function() {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var helper = require('./support/helper');
|
|
1
|
+
import * as sqlite3 from '..';
|
|
4
2
|
|
|
5
3
|
describe('can query parquet', function() {
|
|
6
|
-
var db;
|
|
4
|
+
var db: sqlite3.Database;
|
|
7
5
|
|
|
8
6
|
before(function(done) {
|
|
9
7
|
db = new sqlite3.Database(':memory:', done);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as sqlite3 from "..";
|
|
2
|
+
import * as assert from "assert";
|
|
3
|
+
import {DuckDbError, TableData} from "..";
|
|
3
4
|
|
|
4
5
|
describe("pathname search support", function () {
|
|
5
|
-
let db;
|
|
6
|
+
let db: sqlite3.Database;
|
|
6
7
|
describe("without search paths", () => {
|
|
7
8
|
before((done) => {
|
|
8
9
|
db = new sqlite3.Database(":memory:", done);
|
|
@@ -10,19 +11,20 @@ describe("pathname search support", function () {
|
|
|
10
11
|
|
|
11
12
|
it("supports a full path", function (done) {
|
|
12
13
|
db.prepare('select * from "test/support/prepare.csv"').all(
|
|
13
|
-
(err, result) => {
|
|
14
|
-
assert(err
|
|
15
|
-
assert(result.length
|
|
14
|
+
(err: null | Error, result: TableData) => {
|
|
15
|
+
assert.equal(err, null);
|
|
16
|
+
assert.equal(result.length, 5000);
|
|
16
17
|
done();
|
|
17
18
|
}
|
|
18
19
|
);
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
it("don't not support a partial path", function (done) {
|
|
22
|
-
db.prepare('select * from "prepare.csv"').all((err, result) => {
|
|
23
|
-
assert(err
|
|
24
|
-
assert(err.
|
|
25
|
-
assert(
|
|
23
|
+
db.prepare('select * from "prepare.csv"').all((err: null | DuckDbError, result: TableData) => {
|
|
24
|
+
assert.ok(err);
|
|
25
|
+
assert.equal(err.code, "DUCKDB_NODEJS_ERROR");
|
|
26
|
+
assert.equal(err.errno, -1);
|
|
27
|
+
assert.equal(result, null);
|
|
26
28
|
done();
|
|
27
29
|
});
|
|
28
30
|
});
|
|
@@ -37,18 +39,18 @@ describe("pathname search support", function () {
|
|
|
37
39
|
|
|
38
40
|
it("supports a full path", function (done) {
|
|
39
41
|
db.prepare('select * from "test/support/prepare.csv"').all(
|
|
40
|
-
(err, result) => {
|
|
41
|
-
assert(err
|
|
42
|
-
assert(result.length
|
|
42
|
+
(err: null | Error, result: TableData) => {
|
|
43
|
+
assert.equal(err, null);
|
|
44
|
+
assert.equal(result.length, 5000);
|
|
43
45
|
done();
|
|
44
46
|
}
|
|
45
47
|
);
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
it("supports a partial path", function (done) {
|
|
49
|
-
db.prepare('select * from "prepare.csv"').all((err, result) => {
|
|
50
|
-
assert(err
|
|
51
|
-
assert(result.length
|
|
51
|
+
db.prepare('select * from "prepare.csv"').all((err: null | Error, result: TableData) => {
|
|
52
|
+
assert.equal(err, null);
|
|
53
|
+
assert.equal(result.length, 5000);
|
|
52
54
|
done();
|
|
53
55
|
});
|
|
54
56
|
});
|
|
@@ -63,18 +65,18 @@ describe("pathname search support", function () {
|
|
|
63
65
|
|
|
64
66
|
it("supports a full path", function (done) {
|
|
65
67
|
db.prepare('select * from "test/support/prepare.csv"').all(
|
|
66
|
-
(err, result) => {
|
|
67
|
-
assert(err
|
|
68
|
-
assert(result.length
|
|
68
|
+
(err: null | Error, result: TableData) => {
|
|
69
|
+
assert.equal(err, null);
|
|
70
|
+
assert.equal(result.length, 5000);
|
|
69
71
|
done();
|
|
70
72
|
}
|
|
71
73
|
);
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
it("supports a partial path", function (done) {
|
|
75
|
-
db.prepare('select * from "prepare.csv"').all((err, result) => {
|
|
76
|
-
assert(err
|
|
77
|
-
assert(result.length
|
|
77
|
+
db.prepare('select * from "prepare.csv"').all((err: null | Error, result: TableData) => {
|
|
78
|
+
assert.equal(err, null);
|
|
79
|
+
assert.equal(result.length, 5000);
|
|
78
80
|
done();
|
|
79
81
|
});
|
|
80
82
|
});
|