duckdb 0.6.2-dev710.0 → 0.6.2-dev716.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 +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +3 -0
- package/src/duckdb/src/main/database.cpp +1 -2
- package/src/duckdb/src/main/db_instance_cache.cpp +5 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +16 -0
- package/src/duckdb/src/main/extension_prefix_opener.cpp +2 -10
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
|
2
|
-
#define DUCKDB_VERSION "0.6.2-
|
|
2
|
+
#define DUCKDB_VERSION "0.6.2-dev716"
|
|
3
3
|
#endif
|
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
|
5
|
+
#define DUCKDB_SOURCE_ID "a3ea165426"
|
|
6
6
|
#endif
|
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
|
8
8
|
#include "duckdb/main/database.hpp"
|
|
@@ -57,6 +57,9 @@ public:
|
|
|
57
57
|
static void ReplacementOpenPost(ClientContext &context, const string &extension, DatabaseInstance &instance,
|
|
58
58
|
ReplacementOpenData *open_data);
|
|
59
59
|
|
|
60
|
+
// Returns extension name, or empty string if not a replacement open path
|
|
61
|
+
static string ExtractExtensionPrefixFromPath(const string &path);
|
|
62
|
+
|
|
60
63
|
private:
|
|
61
64
|
static const vector<string> PathComponents();
|
|
62
65
|
static ExtensionInitResult InitialLoad(DBConfig &context, FileOpener *opener, const string &extension);
|
|
@@ -27,8 +27,7 @@ DBConfig::DBConfig() {
|
|
|
27
27
|
error_manager = make_unique<ErrorManager>();
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
DBConfig::DBConfig(std::unordered_map<string, string> &config_dict, bool read_only) {
|
|
31
|
-
compression_functions = make_unique<CompressionFunctionSet>();
|
|
30
|
+
DBConfig::DBConfig(std::unordered_map<string, string> &config_dict, bool read_only) : DBConfig::DBConfig() {
|
|
32
31
|
if (read_only) {
|
|
33
32
|
options.access_mode = AccessMode::READ_ONLY;
|
|
34
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#include "duckdb/main/db_instance_cache.hpp"
|
|
2
|
-
|
|
2
|
+
#include "duckdb/main/extension_helper.hpp"
|
|
3
3
|
namespace duckdb {
|
|
4
4
|
|
|
5
5
|
string GetDBAbsolutePath(const string &database) {
|
|
@@ -10,6 +10,10 @@ string GetDBAbsolutePath(const string &database) {
|
|
|
10
10
|
// this is a memory db, just return it.
|
|
11
11
|
return database;
|
|
12
12
|
}
|
|
13
|
+
if (!ExtensionHelper::ExtractExtensionPrefixFromPath(database).empty()) {
|
|
14
|
+
// this database path is handled by a replacement open and is not a file path
|
|
15
|
+
return database;
|
|
16
|
+
}
|
|
13
17
|
if (FileSystem::IsPathAbsolute(database)) {
|
|
14
18
|
return database;
|
|
15
19
|
}
|
|
@@ -176,4 +176,20 @@ void ExtensionHelper::ReplacementOpenPost(ClientContext &context, const string &
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
string ExtensionHelper::ExtractExtensionPrefixFromPath(const string &path) {
|
|
180
|
+
auto first_colon = path.find(':');
|
|
181
|
+
if (first_colon == string::npos || first_colon < 2) { // needs to be at least two characters because windows c: ...
|
|
182
|
+
return "";
|
|
183
|
+
}
|
|
184
|
+
auto extension = path.substr(0, first_colon);
|
|
185
|
+
D_ASSERT(extension.size() > 1);
|
|
186
|
+
// needs to be alphanumeric
|
|
187
|
+
for (auto &ch : extension) {
|
|
188
|
+
if (!isalnum(ch) && ch != '_') {
|
|
189
|
+
return "";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return extension;
|
|
193
|
+
}
|
|
194
|
+
|
|
179
195
|
} // namespace duckdb
|
|
@@ -16,18 +16,10 @@ struct ExtensionPrefixOpenData : public ReplacementOpenData {
|
|
|
16
16
|
|
|
17
17
|
static unique_ptr<ReplacementOpenData> ExtensionPrefixPreOpen(DBConfig &config, ReplacementOpenStaticData *) {
|
|
18
18
|
auto path = config.options.database_path;
|
|
19
|
-
|
|
20
|
-
if (
|
|
19
|
+
string extension = ExtensionHelper::ExtractExtensionPrefixFromPath(path);
|
|
20
|
+
if (extension.empty()) {
|
|
21
21
|
return nullptr;
|
|
22
22
|
}
|
|
23
|
-
auto extension = path.substr(0, first_colon);
|
|
24
|
-
D_ASSERT(extension.size() > 1);
|
|
25
|
-
// needs to be alphanumeric
|
|
26
|
-
for (auto &ch : extension) {
|
|
27
|
-
if (!isalnum(ch) && ch != '_') {
|
|
28
|
-
return nullptr;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
23
|
auto extension_data = ExtensionHelper::ReplacementOpenPre(extension, config);
|
|
32
24
|
if (extension_data) {
|
|
33
25
|
return make_unique<ExtensionPrefixOpenData>(extension, path, move(extension_data));
|