Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,35 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true

jobs:
duckdb-next-build:
if: false
name: Build extension binaries
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
with:
duckdb_version: main
duckdb_version: v1.4-andium
ci_tools_version: main
extension_name: http_client
exclude_archs: 'windows_amd64_mingw'

duckdb-stable-build:
name: Build extension binaries
uses: duckdb/extension-ci-tools/.github/workflows/[email protected]
if: false # This branch is not compatible with latest stable, TODO: remove when merging this branch back into main
with:
duckdb_version: v1.3.2
ci_tools_version: v1.3.2
extension_name: http_client
exclude_archs: 'windows_amd64_mingw'

code-quality-check:
name: Code Quality Check
uses: duckdb/extension-ci-tools/.github/workflows/_extension_code_quality.yml@main
with:
duckdb_version: main # TODO: revert to latest stable probably
ci_tools_version: main
extension_name: http_client
exclude_archs: 'windows_amd64_mingw'
format_checks: 'format;tidy'
2 changes: 1 addition & 1 deletion duckdb
Submodule duckdb updated 3242 files
27 changes: 9 additions & 18 deletions src/http_client_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "duckdb/common/types.hpp"
#include "duckdb/common/vector_operations/generic_executor.hpp"
#include "duckdb/function/scalar_function.hpp"
#include "duckdb/main/extension_util.hpp"
#include "duckdb/common/atomic.hpp"
#include "duckdb/common/exception/http_exception.hpp"
#include <duckdb/parser/parsed_data/create_scalar_function_info.hpp>
Expand Down Expand Up @@ -359,35 +358,35 @@ static void HTTPPostFormRequestFunction(DataChunk &args, ExpressionState &state,
}


static void LoadInternal(DatabaseInstance &instance) {
static void LoadInternal(ExtensionLoader &loader) {
ScalarFunctionSet http_head("http_head");
http_head.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::JSON(), HTTPHeadRequestFunction));
ExtensionUtil::RegisterFunction(instance, http_head);
loader.RegisterFunction(http_head);

ScalarFunctionSet http_get("http_get");
http_get.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::JSON(), HTTPGetRequestFunction));
http_get.AddFunction(ScalarFunction(
{LogicalType::VARCHAR, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR),
LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)},
LogicalType::JSON(), HTTPGetExRequestFunction));
ExtensionUtil::RegisterFunction(instance, http_get);
loader.RegisterFunction(http_get);

ScalarFunctionSet http_post("http_post");
http_post.AddFunction(ScalarFunction(
{LogicalType::VARCHAR, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR), LogicalType::JSON()},
LogicalType::JSON(), HTTPPostRequestFunction));
ExtensionUtil::RegisterFunction(instance, http_post);
loader.RegisterFunction(http_post);

ScalarFunctionSet http_post_form("http_post_form");
http_post_form.AddFunction(ScalarFunction(
{LogicalType::VARCHAR, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR),
LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)},
LogicalType::JSON(), HTTPPostFormRequestFunction));
ExtensionUtil::RegisterFunction(instance, http_post_form);
loader.RegisterFunction(http_post_form);
}

void HttpClientExtension::Load(DuckDB &db) {
LoadInternal(*db.instance);
void HttpClientExtension::Load(ExtensionLoader &loader) {
LoadInternal(loader);
}

std::string HttpClientExtension::Name() {
Expand All @@ -406,16 +405,8 @@ std::string HttpClientExtension::Version() const {
} // namespace duckdb

extern "C" {
DUCKDB_EXTENSION_API void http_client_init(duckdb::DatabaseInstance &db) {
duckdb::DuckDB db_wrapper(db);
db_wrapper.LoadExtension<duckdb::HttpClientExtension>();
}

DUCKDB_EXTENSION_API const char *http_client_version() {
return duckdb::DuckDB::LibraryVersion();
DUCKDB_CPP_EXTENSION_ENTRY(http_client, loader) {
duckdb::LoadInternal(loader);
}
}

#ifndef DUCKDB_EXTENSION_MAIN
#error DUCKDB_EXTENSION_MAIN not defined
#endif
2 changes: 1 addition & 1 deletion src/include/http_client_extension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using HeaderMap = case_insensitive_map_t<string>;

class HttpClientExtension : public Extension {
public:
void Load(DuckDB &db) override;
void Load(ExtensionLoader &loader) override;
std::string Name() override;
std::string Version() const override;

Expand Down
6 changes: 3 additions & 3 deletions src/include/http_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace duckdb {

struct HTTPFunctions {
public:
static void Register(DatabaseInstance &db) {
RegisterHTTPRequestFunction(db);
static void Register(ExtensionLoader &loader) {
RegisterHTTPRequestFunction(loader);
}

private:
//! Register HTTPRequest functions
static void RegisterHTTPRequestFunction(DatabaseInstance &db);
static void RegisterHTTPRequestFunction(ExtensionLoader &loader);
};

} // namespace duckdb
14 changes: 11 additions & 3 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"dependencies": [
"openssl"
]
"dependencies": [
"openssl"
],
"vcpkg-configuration": {
"overlay-ports": [
"./extension-ci-tools/vcpkg_ports"
],
"overlay-triplets": [
"./extension-ci-tools/toolchains"
]
}
}