duckdb 0.3.1-dev645.0 → 0.3.1-dev657.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.1-dev645.0",
4
+ "version": "0.3.1-dev657.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -102683,6 +102683,33 @@ private:
102683
102683
 
102684
102684
 
102685
102685
 
102686
+ //===----------------------------------------------------------------------===//
102687
+ // DuckDB
102688
+ //
102689
+ // duckdb/main/extension_helper.hpp
102690
+ //
102691
+ //
102692
+ //===----------------------------------------------------------------------===//
102693
+
102694
+
102695
+
102696
+ #include <string>
102697
+
102698
+
102699
+ namespace duckdb {
102700
+ class DuckDB;
102701
+
102702
+ enum class ExtensionLoadResult : uint8_t { LOADED_EXTENSION = 0, EXTENSION_UNKNOWN = 1, NOT_LOADED = 2 };
102703
+
102704
+ class ExtensionHelper {
102705
+ public:
102706
+ static void LoadAllExtensions(DuckDB &db);
102707
+
102708
+ static ExtensionLoadResult LoadExtension(DuckDB &db, const std::string &extension);
102709
+ };
102710
+
102711
+ } // namespace duckdb
102712
+
102686
102713
 
102687
102714
  #ifndef DUCKDB_NO_THREADS
102688
102715
 
@@ -102808,6 +102835,9 @@ void DatabaseInstance::Initialize(const char *path, DBConfig *new_config) {
102808
102835
 
102809
102836
  DuckDB::DuckDB(const char *path, DBConfig *new_config) : instance(make_shared<DatabaseInstance>()) {
102810
102837
  instance->Initialize(path, new_config);
102838
+ if (instance->config.load_extensions) {
102839
+ ExtensionHelper::LoadAllExtensions(*this);
102840
+ }
102811
102841
  }
102812
102842
 
102813
102843
  DuckDB::DuckDB(const string &path, DBConfig *config) : DuckDB(path.c_str(), config) {
@@ -102879,6 +102909,7 @@ void DatabaseInstance::Configure(DBConfig &new_config) {
102879
102909
  } else {
102880
102910
  config.maximum_threads = new_config.maximum_threads;
102881
102911
  }
102912
+ config.load_extensions = new_config.load_extensions;
102882
102913
  config.force_compression = new_config.force_compression;
102883
102914
  config.allocator = move(new_config.allocator);
102884
102915
  config.checkpoint_wal_size = new_config.checkpoint_wal_size;
@@ -102908,6 +102939,102 @@ idx_t DuckDB::NumberOfThreads() {
102908
102939
  } // namespace duckdb
102909
102940
 
102910
102941
 
102942
+ #ifdef BUILD_ICU_EXTENSION
102943
+ #include "icu-extension.hpp"
102944
+ #endif
102945
+
102946
+ #ifdef BUILD_PARQUET_EXTENSION
102947
+ #include "parquet-extension.hpp"
102948
+ #endif
102949
+
102950
+ #ifdef BUILD_TPCH_EXTENSION
102951
+ #include "tpch-extension.hpp"
102952
+ #endif
102953
+
102954
+ #ifdef BUILD_TPCDS_EXTENSION
102955
+ #include "tpcds-extension.hpp"
102956
+ #endif
102957
+
102958
+ #ifdef BUILD_FTS_EXTENSION
102959
+ #include "fts-extension.hpp"
102960
+ #endif
102961
+
102962
+ #ifdef BUILD_HTTPFS_EXTENSION
102963
+ #include "httpfs-extension.hpp"
102964
+ #endif
102965
+
102966
+ #ifdef BUILD_VISUALIZER_EXTENSION
102967
+ #include "visualizer-extension.hpp"
102968
+ #endif
102969
+
102970
+ namespace duckdb {
102971
+
102972
+ void ExtensionHelper::LoadAllExtensions(DuckDB &db) {
102973
+ unordered_set<string> extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs", "visualizer"};
102974
+ for (auto &ext : extensions) {
102975
+ LoadExtension(db, ext);
102976
+ }
102977
+ }
102978
+
102979
+ ExtensionLoadResult ExtensionHelper::LoadExtension(DuckDB &db, const std::string &extension) {
102980
+ if (extension == "parquet") {
102981
+ #ifdef BUILD_PARQUET_EXTENSION
102982
+ db.LoadExtension<ParquetExtension>();
102983
+ #else
102984
+ // parquet extension required but not build: skip this test
102985
+ return ExtensionLoadResult::NOT_LOADED;
102986
+ #endif
102987
+ } else if (extension == "icu") {
102988
+ #ifdef BUILD_ICU_EXTENSION
102989
+ db.LoadExtension<ICUExtension>();
102990
+ #else
102991
+ // icu extension required but not build: skip this test
102992
+ return ExtensionLoadResult::NOT_LOADED;
102993
+ #endif
102994
+ } else if (extension == "tpch") {
102995
+ #ifdef BUILD_TPCH_EXTENSION
102996
+ db.LoadExtension<TPCHExtension>();
102997
+ #else
102998
+ // icu extension required but not build: skip this test
102999
+ return ExtensionLoadResult::NOT_LOADED;
103000
+ #endif
103001
+ } else if (extension == "tpcds") {
103002
+ #ifdef BUILD_TPCDS_EXTENSION
103003
+ db.LoadExtension<TPCDSExtension>();
103004
+ #else
103005
+ // icu extension required but not build: skip this test
103006
+ return ExtensionLoadResult::NOT_LOADED;
103007
+ #endif
103008
+ } else if (extension == "fts") {
103009
+ #ifdef BUILD_FTS_EXTENSION
103010
+ db.LoadExtension<FTSExtension>();
103011
+ #else
103012
+ // fts extension required but not build: skip this test
103013
+ return ExtensionLoadResult::NOT_LOADED;
103014
+ #endif
103015
+ } else if (extension == "httpfs") {
103016
+ #ifdef BUILD_HTTPFS_EXTENSION
103017
+ db.LoadExtension<HTTPFsExtension>();
103018
+ #else
103019
+ return ExtensionLoadResult::NOT_LOADED;
103020
+ #endif
103021
+ } else if (extension == "visualizer") {
103022
+ #ifdef BUILD_VISUALIZER_EXTENSION
103023
+ db.LoadExtension<VisualizerExtension>();
103024
+ #else
103025
+ // visualizer extension required but not build: skip this test
103026
+ return ExtensionLoadResult::NOT_LOADED;
103027
+ #endif
103028
+ } else {
103029
+ // unknown extension
103030
+ return ExtensionLoadResult::EXTENSION_UNKNOWN;
103031
+ }
103032
+ return ExtensionLoadResult::LOADED_EXTENSION;
103033
+ }
103034
+
103035
+ } // namespace duckdb
103036
+
103037
+
102911
103038
 
102912
103039
  namespace duckdb {
102913
103040
 
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "de5f91c7f"
14
- #define DUCKDB_VERSION "0.3.1-dev645"
13
+ #define DUCKDB_SOURCE_ID "0385e028a"
14
+ #define DUCKDB_VERSION "0.3.1-dev657"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //
@@ -10113,6 +10113,8 @@ public:
10113
10113
  idx_t checkpoint_wal_size = 1 << 24;
10114
10114
  //! Whether or not to use Direct IO, bypassing operating system buffers
10115
10115
  bool use_direct_io = false;
10116
+ //! Whether extensions should be loaded on start-up
10117
+ bool load_extensions = true;
10116
10118
  //! The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g.
10117
10119
  //! RamFS or something similar)
10118
10120
  unique_ptr<FileSystem> file_system;