Skip to content

Commit 4872cec

Browse files
committed
fix: changes for 1.4
1 parent bd9f0b0 commit 4872cec

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

src/include/shellfs_extension.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
#include "duckdb.hpp"
44

5-
namespace duckdb {
6-
7-
class ShellfsExtension : public Extension {
8-
public:
9-
void Load(DuckDB &db) override;
10-
std::string Name() override;
11-
};
5+
namespace duckdb
6+
{
7+
8+
class ShellfsExtension : public Extension
9+
{
10+
public:
11+
void Load(ExtensionLoader &loader) override;
12+
std::string Name() override;
13+
};
1214

1315
} // namespace duckdb

src/shellfs_extension.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,41 @@
66
#include "duckdb/common/exception.hpp"
77
#include "duckdb/common/string_util.hpp"
88
#include "duckdb/function/scalar_function.hpp"
9-
#include "duckdb/main/extension_util.hpp"
109

11-
namespace duckdb {
10+
namespace duckdb
11+
{
1212

13-
static void LoadInternal(DatabaseInstance &instance) {
14-
// Register a scalar function
15-
auto &fs = instance.GetFileSystem();
13+
static void LoadInternal(ExtensionLoader &loader)
14+
{
15+
// Register a scalar function
16+
auto &instance = loader.GetDatabaseInstance();
17+
auto &fs = instance.GetFileSystem();
1618

17-
fs.RegisterSubSystem(make_uniq<ShellFileSystem>());
19+
fs.RegisterSubSystem(make_uniq<ShellFileSystem>());
1820

19-
auto &config = DBConfig::GetConfig(instance);
21+
auto &config = DBConfig::GetConfig(instance);
2022

21-
// When writing to a PIPE ignore the SIGPIPE error and consider that the write succeeded.
22-
config.AddExtensionOption("ignore_sigpipe", "Ignore SIGPIPE", LogicalType::BOOLEAN, Value(false));
23+
// When writing to a PIPE ignore the SIGPIPE error and consider that the write succeeded.
24+
config.AddExtensionOption("ignore_sigpipe", "Ignore SIGPIPE", LogicalType::BOOLEAN, Value(false));
25+
}
2326

24-
}
25-
void ShellfsExtension::Load(DuckDB &db) {
26-
LoadInternal(*db.instance);
27-
}
28-
std::string ShellfsExtension::Name() {
29-
return "shellfs";
30-
}
27+
void ShellfsExtension::Load(ExtensionLoader &loader)
28+
{
29+
LoadInternal(loader);
30+
}
3131

32-
} // namespace duckdb
32+
std::string ShellfsExtension::Name()
33+
{
34+
return "shellfs";
35+
}
3336

34-
extern "C" {
37+
} // namespace duckdb
3538

36-
DUCKDB_EXTENSION_API void shellfs_init(duckdb::DatabaseInstance &db) {
37-
duckdb::DuckDB db_wrapper(db);
38-
db_wrapper.LoadExtension<duckdb::ShellfsExtension>();
39-
}
39+
extern "C"
40+
{
4041

41-
DUCKDB_EXTENSION_API const char *shellfs_version() {
42-
return duckdb::DuckDB::LibraryVersion();
42+
DUCKDB_CPP_EXTENSION_ENTRY(shellfs, loader)
43+
{
44+
duckdb::LoadInternal(loader);
45+
}
4346
}
44-
}
45-
46-
#ifndef DUCKDB_EXTENSION_MAIN
47-
#error DUCKDB_EXTENSION_MAIN not defined
48-
#endif

0 commit comments

Comments
 (0)