duckdb 0.5.2-dev2292.0 → 0.5.2-dev2297.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.
@@ -0,0 +1,61 @@
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
+ // Note: arrow IPC api requires the arrow extension to be loaded. The tests for this functionality reside in:
12
+ // 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
+ });
20
+ });
21
+
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
+ );
32
+
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
+ });
40
+
41
+ assert.throws(() => db.register_buffer("ipc_table", [1,'a',1], true), TypeError, "Incorrect parameters");
42
+ });
43
+
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
+ }
51
+
52
+ try {
53
+ db.unregister_buffer();
54
+ assert(0);
55
+ } catch (error) {
56
+ assert(error.message.includes('Register buffer currently not implemented'))
57
+ }
58
+ done()
59
+ });
60
+ });
61
+ });