duckdb 0.6.2-dev6.0 → 0.6.2-dev623.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/Makefile +8 -5
- package/README.md +17 -0
- package/binding.gyp +84 -58
- package/binding.gyp.in +88 -0
- package/configure +1 -7
- package/configure.py +126 -0
- package/filelist.cache +0 -0
- package/lib/duckdb.d.ts +29 -11
- package/lib/duckdb.js +6 -0
- package/package.json +1 -1
- package/src/connection.cpp +7 -1
- package/src/database.cpp +1 -3
- 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/src/duckdb.cpp +0 -343989
- package/src/duckdb.hpp +0 -32676
- package/src/parquet-amalgamation.cpp +0 -44462
- package/src/parquet-amalgamation.hpp +0 -7981
- package/test/support/helper.js +0 -37
package/.mocharc.json
CHANGED
package/Makefile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
all: build
|
|
2
2
|
|
|
3
|
-
src/duckdb.
|
|
3
|
+
src/duckdb/src/include/duckdb.hpp:
|
|
4
4
|
./configure
|
|
5
5
|
|
|
6
6
|
./node_modules:
|
|
7
7
|
npm install --build-from-source
|
|
8
8
|
|
|
9
|
-
build: ./node_modules src/duckdb.
|
|
9
|
+
build: ./node_modules src/duckdb/src/include/duckdb.hpp
|
|
10
10
|
./node_modules/.bin/node-pre-gyp build -j max --loglevel=silent
|
|
11
11
|
|
|
12
|
-
debug: ./node_modules src/duckdb.
|
|
12
|
+
debug: ./node_modules src/duckdb/src/include/duckdb.hpp
|
|
13
13
|
./node_modules/.bin/node-pre-gyp build -j max --debug --verbose
|
|
14
14
|
|
|
15
15
|
clean:
|
|
@@ -17,9 +17,12 @@ clean:
|
|
|
17
17
|
rm -rf lib/binding/
|
|
18
18
|
rm -f test/support/big.db-journal
|
|
19
19
|
rm -rf ./node_modules/
|
|
20
|
-
rm -rf src/duckdb
|
|
21
|
-
rm -
|
|
20
|
+
rm -rf src/duckdb/
|
|
21
|
+
rm -f binding.gyp
|
|
22
22
|
|
|
23
|
+
complete_build:
|
|
24
|
+
./configure
|
|
25
|
+
npm install
|
|
23
26
|
|
|
24
27
|
test:
|
|
25
28
|
npm test
|
package/README.md
CHANGED
|
@@ -99,3 +99,20 @@ var stmt = con.prepare('select ?::INTEGER as fortytwo', function(err, stmt) {
|
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
|
+
|
|
103
|
+
## Development
|
|
104
|
+
|
|
105
|
+
### First install:
|
|
106
|
+
|
|
107
|
+
To install all the dev dependencies of the project, navigate over to `tools/nodejs` and run `npm install` (this uses package.json)
|
|
108
|
+
You might want to add the `--ignore-scripts` option if you don't care about building the package for now and just want to install the dependencies.
|
|
109
|
+
|
|
110
|
+
### Tests:
|
|
111
|
+
Tests are located in `tools/nodejs/test` and can be run with `npm test`
|
|
112
|
+
To run a single test, you can use `npm test -- --grep "name of test as given in describe"`
|
|
113
|
+
|
|
114
|
+
### Additional notes:
|
|
115
|
+
To build the NodeJS package from source, when on Windows, requires the following extra steps:
|
|
116
|
+
- Set `OPENSSL_ROOT_DIR` to the root directory of an OpenSSL installation
|
|
117
|
+
- Supply the `STATIC_OPENSSL=1` option when executing `make`, or set `-DOPENSSL_USE_STATIC_LIBS=1` manually when calling `cmake`
|
|
118
|
+
|
package/binding.gyp
CHANGED
|
@@ -1,90 +1,116 @@
|
|
|
1
1
|
{
|
|
2
2
|
"targets": [
|
|
3
3
|
{
|
|
4
|
-
"target_name": "<(module_name)",
|
|
4
|
+
"target_name": "<(module_name)",
|
|
5
5
|
"sources": [
|
|
6
|
-
"src/duckdb_node.cpp",
|
|
7
|
-
"src/database.cpp",
|
|
8
|
-
"src/data_chunk.cpp",
|
|
9
|
-
"src/connection.cpp",
|
|
10
|
-
"src/statement.cpp",
|
|
11
|
-
"src/utils.cpp"
|
|
12
|
-
|
|
13
|
-
"src/duckdb.cpp" # comment this out to build against existing lib
|
|
14
|
-
],
|
|
6
|
+
"src/duckdb_node.cpp",
|
|
7
|
+
"src/database.cpp",
|
|
8
|
+
"src/data_chunk.cpp",
|
|
9
|
+
"src/connection.cpp",
|
|
10
|
+
"src/statement.cpp",
|
|
11
|
+
"src/utils.cpp"
|
|
12
|
+
],
|
|
15
13
|
"include_dirs": [
|
|
16
|
-
"<!@(node -p \"require('node-addon-api').include\")"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
14
|
+
"<!@(node -p \"require('node-addon-api').include\")",
|
|
15
|
+
"/home/runner/work/duckdb/duckdb/scripts/../src/include",
|
|
16
|
+
"/home/runner/work/duckdb/duckdb/scripts/..",
|
|
17
|
+
"/home/runner/work/duckdb/duckdb/scripts/../third_party/utf8proc/include",
|
|
18
|
+
"/home/runner/work/duckdb/duckdb/scripts/../extension/parquet/include",
|
|
19
|
+
"/home/runner/work/duckdb/duckdb/scripts/../extension/icu/include",
|
|
20
|
+
"/home/runner/work/duckdb/duckdb/scripts/../extension/json/include"
|
|
21
|
+
],
|
|
22
|
+
"defines": [
|
|
23
|
+
"NAPI_DISABLE_CPP_EXCEPTIONS=1",
|
|
24
|
+
"NAPI_VERSION=5",
|
|
25
|
+
"BUILD_PARQUET_EXTENSION",
|
|
26
|
+
"BUILD_ICU_EXTENSION",
|
|
27
|
+
"BUILD_JSON_EXTENSION"
|
|
28
|
+
],
|
|
22
29
|
"cflags_cc": [
|
|
23
|
-
"-frtti",
|
|
24
|
-
"-fexceptions",
|
|
25
|
-
"-Wno-redundant-move"
|
|
26
|
-
],
|
|
30
|
+
"-frtti",
|
|
31
|
+
"-fexceptions",
|
|
32
|
+
"-Wno-redundant-move"
|
|
33
|
+
],
|
|
27
34
|
"cflags_cc!": [
|
|
28
|
-
"-fno-rrti",
|
|
29
|
-
"-fno-exceptions"
|
|
30
|
-
],
|
|
35
|
+
"-fno-rrti",
|
|
36
|
+
"-fno-exceptions"
|
|
37
|
+
],
|
|
31
38
|
"cflags": [
|
|
32
|
-
"-frtti",
|
|
33
|
-
"-fexceptions",
|
|
34
|
-
"-Wno-redundant-move"
|
|
35
|
-
],
|
|
39
|
+
"-frtti",
|
|
40
|
+
"-fexceptions",
|
|
41
|
+
"-Wno-redundant-move"
|
|
42
|
+
],
|
|
36
43
|
"cflags!": [
|
|
37
|
-
"-fno-rrti",
|
|
38
|
-
"-fno-exceptions"
|
|
39
|
-
],
|
|
44
|
+
"-fno-rrti",
|
|
45
|
+
"-fno-exceptions"
|
|
46
|
+
],
|
|
40
47
|
"xcode_settings": {
|
|
41
|
-
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
42
|
-
"GCC_ENABLE_CPP_RTTI": "YES",
|
|
43
|
-
"CLANG_CXX_LIBRARY": "libc++",
|
|
44
|
-
"MACOSX_DEPLOYMENT_TARGET": "10.15",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
49
|
+
"GCC_ENABLE_CPP_RTTI": "YES",
|
|
50
|
+
"CLANG_CXX_LIBRARY": "libc++",
|
|
51
|
+
"MACOSX_DEPLOYMENT_TARGET": "10.15",
|
|
52
|
+
"CLANG_CXX_LANGUAGE_STANDARD": "c++11",
|
|
53
|
+
"OTHER_CFLAGS": [
|
|
54
|
+
"-fexceptions",
|
|
55
|
+
"-frtti",
|
|
56
|
+
"-Wno-redundant-move"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
49
59
|
"msvs_settings": {
|
|
50
60
|
"VCCLCompilerTool": {
|
|
51
|
-
"ExceptionHandling": 1,
|
|
61
|
+
"ExceptionHandling": 1,
|
|
52
62
|
"AdditionalOptions": [
|
|
53
63
|
"/bigobj"
|
|
54
64
|
]
|
|
55
65
|
}
|
|
56
|
-
},
|
|
66
|
+
},
|
|
57
67
|
"conditions": [
|
|
58
68
|
[
|
|
59
|
-
|
|
69
|
+
"OS==\"win\"",
|
|
60
70
|
{
|
|
61
71
|
"defines": [
|
|
62
72
|
"DUCKDB_BUILD_LIBRARY"
|
|
63
73
|
]
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
],
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
],
|
|
77
|
+
"libraries": [
|
|
78
|
+
"/home/runner/work/duckdb/duckdb/build/release/src/libduckdb_static.a",
|
|
79
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/parquet/libparquet_extension.a",
|
|
80
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/icu/libicu_extension.a",
|
|
81
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/json/libjson_extension.a",
|
|
82
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/fsst/libduckdb_fsst.a",
|
|
83
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/fmt/libduckdb_fmt.a",
|
|
84
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/libpg_query/libduckdb_pg_query.a",
|
|
85
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/re2/libduckdb_re2.a",
|
|
86
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/miniz/libduckdb_miniz.a",
|
|
87
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/utf8proc/libduckdb_utf8proc.a",
|
|
88
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/hyperloglog/libduckdb_hyperloglog.a",
|
|
89
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/fastpforlib/libduckdb_fastpforlib.a",
|
|
90
|
+
"/home/runner/work/duckdb/duckdb/build/release/third_party/mbedtls/libduckdb_mbedtls.a",
|
|
91
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/jemalloc/libjemalloc_extension.a",
|
|
92
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/parquet/libparquet_extension.a",
|
|
93
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/icu/libicu_extension.a",
|
|
94
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/tpch/libtpch_extension.a",
|
|
95
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/httpfs/libhttpfs_extension.a",
|
|
96
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/visualizer/libvisualizer_extension.a",
|
|
97
|
+
"/home/runner/work/duckdb/duckdb/build/release/extension/json/libjson_extension.a"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
76
100
|
{
|
|
77
|
-
"target_name": "action_after_build",
|
|
78
|
-
"type": "none",
|
|
101
|
+
"target_name": "action_after_build",
|
|
102
|
+
"type": "none",
|
|
79
103
|
"dependencies": [
|
|
80
104
|
"<(module_name)"
|
|
81
|
-
],
|
|
105
|
+
],
|
|
82
106
|
"copies": [
|
|
83
107
|
{
|
|
84
|
-
"files": [
|
|
108
|
+
"files": [
|
|
109
|
+
"<(PRODUCT_DIR)/<(module_name).node"
|
|
110
|
+
],
|
|
85
111
|
"destination": "<(module_path)"
|
|
86
112
|
}
|
|
87
113
|
]
|
|
88
114
|
}
|
|
89
115
|
]
|
|
90
|
-
}
|
|
116
|
+
}
|
package/binding.gyp.in
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "<(module_name)",
|
|
5
|
+
"sources": [
|
|
6
|
+
"src/duckdb_node.cpp",
|
|
7
|
+
"src/database.cpp",
|
|
8
|
+
"src/data_chunk.cpp",
|
|
9
|
+
"src/connection.cpp",
|
|
10
|
+
"src/statement.cpp",
|
|
11
|
+
"src/utils.cpp",
|
|
12
|
+
"${SOURCE_FILES}"
|
|
13
|
+
],
|
|
14
|
+
"include_dirs": [
|
|
15
|
+
"<!@(node -p \"require('node-addon-api').include\")",
|
|
16
|
+
"${INCLUDE_FILES}"
|
|
17
|
+
],
|
|
18
|
+
"defines": [
|
|
19
|
+
"NAPI_DISABLE_CPP_EXCEPTIONS=1",
|
|
20
|
+
"NAPI_VERSION=5",
|
|
21
|
+
"${DEFINES}"
|
|
22
|
+
],
|
|
23
|
+
"cflags_cc": [
|
|
24
|
+
"-frtti",
|
|
25
|
+
"-fexceptions",
|
|
26
|
+
"-Wno-redundant-move"
|
|
27
|
+
],
|
|
28
|
+
"cflags_cc!": [
|
|
29
|
+
"-fno-rrti",
|
|
30
|
+
"-fno-exceptions"
|
|
31
|
+
],
|
|
32
|
+
"cflags": [
|
|
33
|
+
"-frtti",
|
|
34
|
+
"-fexceptions",
|
|
35
|
+
"-Wno-redundant-move",
|
|
36
|
+
"${CFLAGS}"
|
|
37
|
+
],
|
|
38
|
+
"cflags!": [
|
|
39
|
+
"-fno-rrti",
|
|
40
|
+
"-fno-exceptions"
|
|
41
|
+
],
|
|
42
|
+
"xcode_settings": {
|
|
43
|
+
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
44
|
+
"GCC_ENABLE_CPP_RTTI": "YES",
|
|
45
|
+
"CLANG_CXX_LIBRARY": "libc++",
|
|
46
|
+
"MACOSX_DEPLOYMENT_TARGET": "10.15",
|
|
47
|
+
"CLANG_CXX_LANGUAGE_STANDARD": "c++11",
|
|
48
|
+
"OTHER_CFLAGS" : ["-fexceptions", "-frtti", "-Wno-redundant-move"]
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
"msvs_settings": {
|
|
52
|
+
"VCCLCompilerTool": {
|
|
53
|
+
"ExceptionHandling": 1,
|
|
54
|
+
"AdditionalOptions": [
|
|
55
|
+
"/bigobj",
|
|
56
|
+
"${WINDOWS_OPTIONS}"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"conditions": [
|
|
61
|
+
[
|
|
62
|
+
"OS==\"win\"",
|
|
63
|
+
{
|
|
64
|
+
"defines": [
|
|
65
|
+
"DUCKDB_BUILD_LIBRARY"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
],
|
|
70
|
+
"libraries": [
|
|
71
|
+
"${LIBRARY_FILES}"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"target_name": "action_after_build",
|
|
76
|
+
"type": "none",
|
|
77
|
+
"dependencies": [
|
|
78
|
+
"<(module_name)"
|
|
79
|
+
],
|
|
80
|
+
"copies": [
|
|
81
|
+
{
|
|
82
|
+
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
|
83
|
+
"destination": "<(module_path)"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
package/configure
CHANGED
|
@@ -5,10 +5,4 @@ set -x
|
|
|
5
5
|
|
|
6
6
|
cd `dirname $0`
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
echo "Could not find the amalgamation build script"
|
|
10
|
-
exit 1
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
(cd ../.. && python3 scripts/amalgamation.py --extended --source=tools/nodejs/src/duckdb.cpp --header=tools/nodejs/src/duckdb.hpp)
|
|
14
|
-
(cd ../.. && python3 scripts/parquet_amalgamation.py && cp src/amalgamation/parquet-amalgamation* tools/nodejs/src/)
|
|
8
|
+
python3 configure.py
|
package/configure.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
import pickle
|
|
5
|
+
|
|
6
|
+
# list of extensions to bundle
|
|
7
|
+
extensions = ['parquet', 'icu', 'json']
|
|
8
|
+
|
|
9
|
+
# path to target
|
|
10
|
+
basedir = os.getcwd()
|
|
11
|
+
target_dir = os.path.join(basedir, 'src', 'duckdb')
|
|
12
|
+
gyp_in = os.path.join(basedir, 'binding.gyp.in')
|
|
13
|
+
gyp_out = os.path.join(basedir, 'binding.gyp')
|
|
14
|
+
cache_file = os.path.join(basedir, 'filelist.cache')
|
|
15
|
+
|
|
16
|
+
# path to package_build.py
|
|
17
|
+
os.chdir(os.path.join('..', '..'))
|
|
18
|
+
scripts_dir = 'scripts'
|
|
19
|
+
|
|
20
|
+
sys.path.append(scripts_dir)
|
|
21
|
+
import package_build
|
|
22
|
+
|
|
23
|
+
defines = ['BUILD_{}_EXTENSION'.format(ext.upper()) for ext in extensions]
|
|
24
|
+
|
|
25
|
+
if 'DUCKDB_NODE_BUILD_CACHE' in os.environ and os.path.isfile(cache_file):
|
|
26
|
+
with open(cache_file, 'rb') as f:
|
|
27
|
+
cache = pickle.load(f)
|
|
28
|
+
source_list = cache['source_list']
|
|
29
|
+
include_list = cache['include_list']
|
|
30
|
+
libraries = cache['libraries']
|
|
31
|
+
windows_options = cache['windows_options']
|
|
32
|
+
cflags = cache['cflags']
|
|
33
|
+
elif 'DUCKDB_NODE_BINDIR' in os.environ:
|
|
34
|
+
def find_library_path(libdir, libname):
|
|
35
|
+
flist = os.listdir(libdir)
|
|
36
|
+
for fname in flist:
|
|
37
|
+
fpath = os.path.join(libdir, fname)
|
|
38
|
+
if os.path.isfile(fpath) and package_build.file_is_lib(fname, libname):
|
|
39
|
+
return fpath
|
|
40
|
+
raise Exception(f"Failed to find library {libname} in {libdir}")
|
|
41
|
+
# existing build
|
|
42
|
+
existing_duckdb_dir = os.environ['DUCKDB_NODE_BINDIR']
|
|
43
|
+
cflags = os.environ['DUCKDB_NODE_CFLAGS']
|
|
44
|
+
libraries = os.environ['DUCKDB_NODE_LIBS'].split(' ')
|
|
45
|
+
|
|
46
|
+
include_directories = [os.path.join('..', '..', include) for include in package_build.third_party_includes()]
|
|
47
|
+
include_list = package_build.includes(extensions)
|
|
48
|
+
|
|
49
|
+
result_libraries = package_build.get_libraries(existing_duckdb_dir, libraries, extensions)
|
|
50
|
+
libraries = []
|
|
51
|
+
for (libdir, libname) in result_libraries:
|
|
52
|
+
if libdir is None:
|
|
53
|
+
continue
|
|
54
|
+
libraries.append(find_library_path(libdir, libname))
|
|
55
|
+
|
|
56
|
+
source_list = []
|
|
57
|
+
cflags = []
|
|
58
|
+
windows_options = []
|
|
59
|
+
if os.name == 'nt':
|
|
60
|
+
windows_options = [x for x in os.environ['DUCKDB_NODE_CFLAGS'].split(' ') if x.startswith('/')]
|
|
61
|
+
else:
|
|
62
|
+
if '-g' in os.environ['DUCKDB_NODE_CFLAGS']:
|
|
63
|
+
cflags += ['-g']
|
|
64
|
+
if '-O0' in os.environ['DUCKDB_NODE_CFLAGS']:
|
|
65
|
+
cflags += ['-O0']
|
|
66
|
+
|
|
67
|
+
if 'DUCKDB_NODE_BUILD_CACHE' in os.environ:
|
|
68
|
+
cache = {
|
|
69
|
+
'source_list': source_list,
|
|
70
|
+
'include_list': include_list,
|
|
71
|
+
'libraries': libraries,
|
|
72
|
+
'cflags': cflags,
|
|
73
|
+
'windows_options': windows_options
|
|
74
|
+
}
|
|
75
|
+
with open(cache_file, 'wb+') as f:
|
|
76
|
+
pickle.dump(cache, f)
|
|
77
|
+
else:
|
|
78
|
+
# fresh build - copy over all of the files
|
|
79
|
+
(source_list, include_list, original_sources) = package_build.build_package(target_dir, extensions, False)
|
|
80
|
+
|
|
81
|
+
# # the list of all source files (.cpp files) that have been copied into the `duckdb_source_copy` directory
|
|
82
|
+
# print(source_list)
|
|
83
|
+
# # the list of all include files
|
|
84
|
+
# print(include_list)
|
|
85
|
+
source_list = [os.path.relpath(x, basedir) if os.path.isabs(x) else os.path.join('src', x) for x in source_list]
|
|
86
|
+
include_list = [os.path.join('src', 'duckdb', x) for x in include_list]
|
|
87
|
+
libraries = []
|
|
88
|
+
windows_options = []
|
|
89
|
+
cflags = []
|
|
90
|
+
|
|
91
|
+
def sanitize_path(x):
|
|
92
|
+
return x.replace('\\', '/')
|
|
93
|
+
|
|
94
|
+
source_list = [sanitize_path(x) for x in source_list]
|
|
95
|
+
include_list = [sanitize_path(x) for x in include_list]
|
|
96
|
+
libraries = [sanitize_path(x) for x in libraries]
|
|
97
|
+
|
|
98
|
+
with open(gyp_in, 'r') as f:
|
|
99
|
+
input_json = json.load(f)
|
|
100
|
+
|
|
101
|
+
def replace_entries(node, replacement_map):
|
|
102
|
+
if type(node) == type([]):
|
|
103
|
+
for key in replacement_map.keys():
|
|
104
|
+
if key in node:
|
|
105
|
+
node.remove(key)
|
|
106
|
+
node += replacement_map[key]
|
|
107
|
+
for entry in node:
|
|
108
|
+
if type(entry) == type([]) or type(entry) == type({}):
|
|
109
|
+
replace_entries(entry, replacement_map)
|
|
110
|
+
if type(node) == type({}):
|
|
111
|
+
for key in node.keys():
|
|
112
|
+
replace_entries(node[key], replacement_map)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
replacement_map = {}
|
|
116
|
+
replacement_map['${SOURCE_FILES}'] = source_list
|
|
117
|
+
replacement_map['${INCLUDE_FILES}'] = include_list
|
|
118
|
+
replacement_map['${DEFINES}'] = defines
|
|
119
|
+
replacement_map['${LIBRARY_FILES}'] = libraries
|
|
120
|
+
replacement_map['${CFLAGS}'] = cflags
|
|
121
|
+
replacement_map['${WINDOWS_OPTIONS}'] = windows_options
|
|
122
|
+
|
|
123
|
+
replace_entries(input_json, replacement_map)
|
|
124
|
+
|
|
125
|
+
with open(gyp_out, 'w+') as f:
|
|
126
|
+
json.dump(input_json, f, indent=4, separators=(", ", ": "))
|
package/filelist.cache
ADDED
|
Binary file
|
package/lib/duckdb.d.ts
CHANGED
|
@@ -49,15 +49,16 @@ export class QueryResult {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export class Database {
|
|
52
|
-
constructor(path: string, accessMode?: number, callback?: Callback<any>);
|
|
52
|
+
constructor(path: string, accessMode?: number | Record<string,string>, callback?: Callback<any>);
|
|
53
|
+
constructor(path: string, callback?: Callback<any>);
|
|
53
54
|
|
|
54
|
-
close(callback
|
|
55
|
+
close(callback?: Callback<void>): void;
|
|
55
56
|
|
|
56
57
|
connect(): Connection;
|
|
57
58
|
|
|
58
|
-
all(sql: string, ...args: [...any, Callback<TableData>] | []):
|
|
59
|
-
arrowIPCAll(sql: string, ...args: [...any, Callback<
|
|
60
|
-
each(sql: string, ...args: [...any, Callback<RowData>] | []):
|
|
59
|
+
all(sql: string, ...args: [...any, Callback<TableData>] | []): this;
|
|
60
|
+
arrowIPCAll(sql: string, ...args: [...any, Callback<QueryResult>] | []): void;
|
|
61
|
+
each(sql: string, ...args: [...any, Callback<RowData>] | []): this;
|
|
61
62
|
exec(sql: string, ...args: [...any, Callback<void>] | []): void;
|
|
62
63
|
|
|
63
64
|
prepare(sql: string, ...args: [...any, Callback<Statement>] | []): Statement;
|
|
@@ -71,21 +72,36 @@ export class Database {
|
|
|
71
72
|
unregister_udf(name: string, callback: Callback<any>): void;
|
|
72
73
|
|
|
73
74
|
stream(sql: any, ...args: any[]): QueryResult;
|
|
74
|
-
arrowIPCStream(sql: any, ...args: any[]): QueryResult
|
|
75
|
+
arrowIPCStream(sql: any, ...args: any[]): Promise<QueryResult>;
|
|
76
|
+
|
|
77
|
+
serialize(done?: Callback<void>): void;
|
|
78
|
+
parallelize(done?: Callback<void>): void;
|
|
79
|
+
wait(done: Callback<void>): void;
|
|
80
|
+
|
|
81
|
+
get(columnName: string, cb: Callback<RowData>): void;
|
|
82
|
+
get(columnName: string, num: number, cb: Callback<RowData>): void;
|
|
83
|
+
|
|
84
|
+
interrupt(): void;
|
|
85
|
+
|
|
86
|
+
register_buffer(name: string, array: ArrayLike<any>, force: boolean, callback?: Callback<void>): void;
|
|
87
|
+
|
|
88
|
+
unregister_buffer(name: string, callback?: Callback<void>): void;
|
|
75
89
|
}
|
|
76
90
|
|
|
77
91
|
export class Statement {
|
|
78
|
-
|
|
92
|
+
sql: string;
|
|
79
93
|
|
|
80
|
-
|
|
94
|
+
constructor(connection: Connection, sql: string);
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
all(...args: [...any, Callback<TableData>] | any[]): this;
|
|
83
97
|
|
|
84
|
-
|
|
98
|
+
arrowIPCAll(...args: [...any, Callback<TableData>] | any[]): void;
|
|
99
|
+
|
|
100
|
+
each(...args: [...any, Callback<RowData>] | any[]): this;
|
|
85
101
|
|
|
86
102
|
finalize(callback?: Callback<void>): void;
|
|
87
103
|
|
|
88
|
-
run(...args: [...any, Callback<void>] | []): Statement;
|
|
104
|
+
run(...args: [...any, Callback<void>] | any[]): Statement;
|
|
89
105
|
}
|
|
90
106
|
|
|
91
107
|
export const ERROR: number;
|
|
@@ -101,3 +117,5 @@ export const OPEN_READONLY: number;
|
|
|
101
117
|
export const OPEN_READWRITE: number;
|
|
102
118
|
|
|
103
119
|
export const OPEN_SHAREDCACHE: number;
|
|
120
|
+
|
|
121
|
+
export const INTERRUPT: number;
|
package/lib/duckdb.js
CHANGED
package/package.json
CHANGED
package/src/connection.cpp
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#include "duckdb.hpp"
|
|
2
2
|
#include "duckdb_node.hpp"
|
|
3
3
|
#include "napi.h"
|
|
4
|
-
|
|
4
|
+
#include "duckdb/parser/parser.hpp"
|
|
5
|
+
#include "duckdb/parser/parsed_data/drop_info.hpp"
|
|
6
|
+
#include "duckdb/parser/expression/cast_expression.hpp"
|
|
5
7
|
#include <iostream>
|
|
6
8
|
#include <thread>
|
|
7
9
|
|
|
@@ -242,6 +244,7 @@ struct RegisterUdfTask : public Task {
|
|
|
242
244
|
// here we can do only DuckDB stuff because we do not have a functioning env
|
|
243
245
|
|
|
244
246
|
// Flatten all args to simplify udfs
|
|
247
|
+
bool all_constant = args.AllConstant();
|
|
245
248
|
args.Flatten();
|
|
246
249
|
|
|
247
250
|
JSArgs jsargs;
|
|
@@ -257,6 +260,9 @@ struct RegisterUdfTask : public Task {
|
|
|
257
260
|
if (jsargs.error) {
|
|
258
261
|
jsargs.error.Throw();
|
|
259
262
|
}
|
|
263
|
+
if (all_constant) {
|
|
264
|
+
result.SetVectorType(duckdb::VectorType::CONSTANT_VECTOR);
|
|
265
|
+
}
|
|
260
266
|
};
|
|
261
267
|
|
|
262
268
|
auto expr = duckdb::Parser::ParseExpressionList(duckdb::StringUtil::Format("asdf::%s", return_type_name));
|
package/src/database.cpp
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#include "duckdb_node.hpp"
|
|
2
|
+
#include "duckdb/storage/buffer_manager.hpp"
|
|
2
3
|
#include "napi.h"
|
|
3
|
-
#include "parquet-amalgamation.hpp"
|
|
4
4
|
|
|
5
5
|
namespace node_duckdb {
|
|
6
6
|
|
|
@@ -56,8 +56,6 @@ struct OpenTask : public Task {
|
|
|
56
56
|
void DoWork() override {
|
|
57
57
|
try {
|
|
58
58
|
Get<Database>().database = duckdb::make_unique<duckdb::DuckDB>(filename, &duckdb_config);
|
|
59
|
-
duckdb::ParquetExtension extension;
|
|
60
|
-
extension.Load(*Get<Database>().database);
|
|
61
59
|
success = true;
|
|
62
60
|
|
|
63
61
|
} catch (const duckdb::Exception &ex) {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as sqlite3 from '..';
|
|
2
|
+
import * as assert from 'assert';
|
|
3
3
|
|
|
4
4
|
describe('query properties', function() {
|
|
5
|
-
var db;
|
|
5
|
+
var db: sqlite3.Database;
|
|
6
6
|
before(function(done) {
|
|
7
7
|
db = new sqlite3.Database(':memory:');
|
|
8
8
|
db.run("CREATE TABLE foo (id INT, txt TEXT)", done);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
it('should return the correct lastID', function(done) {
|
|
11
|
+
it.skip('should return the correct lastID', function(done) {
|
|
13
12
|
var stmt = db.prepare("INSERT INTO foo VALUES(?, ?)");
|
|
14
13
|
var j = 1;
|
|
15
14
|
for (var i = 0; i < 5000; i++) {
|
|
16
|
-
stmt.run(i, "demo", function(err) {
|
|
15
|
+
stmt.run(i, "demo", function(err: null | Error) {
|
|
17
16
|
if (err) throw err;
|
|
18
17
|
// Relies on SQLite's row numbering to be gapless and starting
|
|
19
18
|
// from 1.
|
|
19
|
+
// @ts-ignore
|
|
20
20
|
assert.equal(j++, this.lastID);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -24,13 +24,11 @@ describe('query properties', function() {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
it('should return the correct changes count', function(done) {
|
|
28
|
-
db.run("UPDATE foo SET id = id + 1 WHERE id % 2 = 0", function(err) {
|
|
27
|
+
it.skip('should return the correct changes count', function(done) {
|
|
28
|
+
db.run("UPDATE foo SET id = id + 1 WHERE id % 2 = 0", function(err: null | Error) {
|
|
29
29
|
if (err) throw err;
|
|
30
30
|
// FIXME assert.equal(2500, this.changes);
|
|
31
31
|
done();
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
34
|
});
|