duckdb 0.6.1-dev131.0 → 0.6.1-dev140.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.
@@ -1,60 +1,51 @@
1
- var sqlite3 = require('..');
1
+ var duckdb = require('..');
2
2
  var assert = require('assert');
3
3
  var fs = require('fs');
4
4
 
5
- describe('exec', function() {
6
- var db;
7
- before(function(done) {
8
- db = new sqlite3.Database(':memory:', done);
9
- });
10
-
5
+ describe('arrow IPC API fails neatly when extension not loaded', function() {
11
6
  // Note: arrow IPC api requires the arrow extension to be loaded. The tests for this functionality reside in:
12
7
  // https://github.com/duckdblabs/arrow
13
- describe(`Arrow IPC API fails neatly when extension not loaded`, () => {
14
- let db;
15
- let conn;
16
- before((done) => {
17
- db = new sqlite3.Database(':memory:', {"allow_unsigned_extensions": "true"}, () => {
18
- done();
19
- });
8
+ let db;
9
+ let conn;
10
+ before((done) => {
11
+ db = new duckdb.Database(':memory:', {"allow_unsigned_extensions": "true"}, () => {
12
+ done();
20
13
  });
14
+ });
21
15
 
22
- it(`Basic examples`, async () => {
23
- const range_size = 130000;
24
- const query = `SELECT * FROM range(0,${range_size}) tbl(i)`;
25
-
26
- db.arrowIPCStream(query).then(
27
- () => Promise.reject(new Error('Expected method to reject.')),
28
- err => {
29
- assert(err.message.includes("Catalog Error: Function with name to_arrow_ipc is not on the catalog, but it exists in the arrow extension. To Install and Load the extension, run: INSTALL arrow; LOAD arrow;"))
30
- }
31
- );
16
+ it(`basic examples`, async () => {
17
+ const range_size = 130000;
18
+ const query = `SELECT * FROM range(0,${range_size}) tbl(i)`;
32
19
 
33
- db.arrowIPCAll(`SELECT * FROM ipc_table`, function (err, result) {
34
- if (err) {
35
- assert(err.message.includes("Catalog Error: Function with name to_arrow_ipc is not on the catalog, but it exists in the arrow extension. To Install and Load the extension, run: INSTALL arrow; LOAD arrow;"))
36
- } else {
37
- assert.fail("Expected error");
38
- }
39
- });
20
+ db.arrowIPCStream(query).then(
21
+ () => Promise.reject(new Error('Expected method to reject.')),
22
+ err => {
23
+ assert(err.message.includes("Catalog Error: Function with name to_arrow_ipc is not on the catalog, but it exists in the arrow extension. To Install and Load the extension, run: INSTALL arrow; LOAD arrow;"))
24
+ }
25
+ );
40
26
 
41
- assert.throws(() => db.register_buffer("ipc_table", [1,'a',1], true), TypeError, "Incorrect parameters");
27
+ db.arrowIPCAll(`SELECT * FROM ipc_table`, function (err, result) {
28
+ if (err) {
29
+ assert(err.message.includes("Catalog Error: Function with name to_arrow_ipc is not on the catalog, but it exists in the arrow extension. To Install and Load the extension, run: INSTALL arrow; LOAD arrow;"))
30
+ } else {
31
+ assert.fail("Expected error");
32
+ }
42
33
  });
43
34
 
44
- it('Register buffer should be disabled currently', function(done) {
45
- try {
46
- db.register_buffer();
47
- assert(0);
48
- } catch (error) {
49
- assert(error.message.includes('Register buffer currently not implemented'))
50
- }
35
+ assert.throws(() => db.register_buffer("ipc_table", [1,'a',1], true), TypeError, "Incorrect parameters");
36
+ });
51
37
 
52
- try {
53
- db.unregister_buffer();
54
- assert(0);
55
- } catch (error) {
56
- assert(error.message.includes('Register buffer currently not implemented'))
57
- }
38
+ it('register buffer should be disabled currently', function(done) {
39
+ db.register_buffer("test", [new Uint8Array(new ArrayBuffer(10))], true, (err) => {
40
+ assert(err)
41
+ assert(err.includes("Function with name scan_arrow_ipc is not on the catalog, but it exists in the arrow extension. To Install and Load the extension, run: INSTALL arrow; LOAD arrow;"));
42
+ done()
43
+ });
44
+ });
45
+
46
+ it('unregister will silently do nothing', function(done) {
47
+ db.unregister_buffer("test", (err) => {
48
+ assert(!err)
58
49
  done()
59
50
  });
60
51
  });