Skip to content

Commit

Permalink
also remove extension hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Mühleisen committed Jun 7, 2024
1 parent 485e04e commit 17333b0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 117 deletions.
37 changes: 1 addition & 36 deletions generate-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,44 +40,9 @@
'duckdb_prepared_statement',
'duckdb_value',
'duckdb_vector',
#'duckdb_arrow',
#'duckdb_arrow_array',
#'duckdb_arrow_schema',
#'duckdb_arrow_stream',
]

deprecated_functions = [
'duckdb_column_data',
'duckdb_nullmask_data',
'duckdb_validity_row_is_valid',
'duckdb_validity_set_row_invalid',
'duckdb_validity_set_row_valid',
'duckdb_validity_set_row_validity',
'duckdb_vector_ensure_validity_writable',
'duckdb_value_blob',
'duckdb_value_boolean',
'duckdb_value_date',
'duckdb_value_decimal',
'duckdb_value_double',
'duckdb_value_float',
'duckdb_value_hugeint',
'duckdb_value_int16',
'duckdb_value_int32',
'duckdb_value_int64',
'duckdb_value_int8',
'duckdb_value_interval',
'duckdb_value_is_null',
'duckdb_value_string',
'duckdb_value_string_internal',
'duckdb_value_time',
'duckdb_value_timestamp',
'duckdb_value_uint16',
'duckdb_value_uint32',
'duckdb_value_uint64',
'duckdb_value_uint8',
'duckdb_value_varchar',
'duckdb_value_varchar_internal',
"duckdb_bind_set_bind_data",
]

def typename(decl):
Expand Down Expand Up @@ -257,7 +222,7 @@ def create_func_defs(filename):
zip.extract("duckdb.h", tmp)

os.system("sed -i -e 's/#include <stdlib.h>/#include <stddef.h>/' %s" % os.path.join(tmp, "duckdb.h")) # until 0.10.0 has been released
os.system("gcc -DDUCKDB_API_NO_DEPRECATED -E -D__builtin_va_list=int %s > %s" % (os.path.join(tmp, "duckdb.h"), os.path.join(tmp, "duckdb-preprocessed.h")))
os.system("gcc -DDUCKDB_NO_EXTENSION_FUNCTIONS -DDUCKDB_API_NO_DEPRECATED -E -D__builtin_va_list=int %s > %s" % (os.path.join(tmp, "duckdb.h"), os.path.join(tmp, "duckdb-preprocessed.h")))

cpp_result, types_result = create_func_defs(os.path.join(tmp, "duckdb-preprocessed.h"))

Expand Down
30 changes: 5 additions & 25 deletions lib/duckdb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ export class duckdb_config {}
export class duckdb_logical_type {}
export class duckdb_data_chunk {}
export class duckdb_value {}
export class duckdb_table_function {}
export class duckdb_bind_info {}
export class duckdb_init_info {}
export class duckdb_function_info {}
export class duckdb_replacement_scan_info {}
export class duckdb_arrow {}
export class duckdb_arrow_stream {}
export class duckdb_arrow_schema {}
Expand Down Expand Up @@ -262,6 +257,7 @@ export function duckdb_data_chunk_set_size(chunk: duckdb_data_chunk, size: numbe
export function duckdb_vector_get_column_type(vector: duckdb_vector): duckdb_logical_type;
export function duckdb_vector_get_data(vector: duckdb_vector): pointer;
export function duckdb_vector_get_validity(vector: duckdb_vector): uint64_pointer;
export function duckdb_vector_ensure_validity_writable(vector: duckdb_vector): void;
export function duckdb_vector_assign_string_element(vector: duckdb_vector, index: number, str: string): void;
export function duckdb_vector_assign_string_element_len(vector: duckdb_vector, index: number, str: string, str_len: number): void;
export function duckdb_list_vector_get_child(vector: duckdb_vector): duckdb_vector;
Expand All @@ -270,18 +266,10 @@ export function duckdb_list_vector_set_size(vector: duckdb_vector, size: number)
export function duckdb_list_vector_reserve(vector: duckdb_vector, required_capacity: number): duckdb_state;
export function duckdb_struct_vector_get_child(vector: duckdb_vector, index: number): duckdb_vector;
export function duckdb_array_vector_get_child(vector: duckdb_vector): duckdb_vector;
export function duckdb_bind_get_extra_info(info: duckdb_bind_info): pointer;
export function duckdb_bind_add_result_column(info: duckdb_bind_info, name: string, type: duckdb_logical_type): void;
export function duckdb_bind_get_parameter_count(info: duckdb_bind_info): number;
export function duckdb_bind_get_parameter(info: duckdb_bind_info, index: number): duckdb_value;
export function duckdb_bind_get_named_parameter(info: duckdb_bind_info, name: string): duckdb_value;
export function duckdb_bind_set_cardinality(info: duckdb_bind_info, cardinality: number, is_exact: boolean): void;
export function duckdb_bind_set_error(info: duckdb_bind_info, error: string): void;
export function duckdb_function_get_extra_info(info: duckdb_function_info): pointer;
export function duckdb_function_get_bind_data(info: duckdb_function_info): pointer;
export function duckdb_function_get_init_data(info: duckdb_function_info): pointer;
export function duckdb_function_get_local_init_data(info: duckdb_function_info): pointer;
export function duckdb_function_set_error(info: duckdb_function_info, error: string): void;
export function duckdb_validity_row_is_valid(validity: uint64_pointer, row: number): boolean;
export function duckdb_validity_set_row_validity(validity: uint64_pointer, row: number, valid: boolean): void;
export function duckdb_validity_set_row_invalid(validity: uint64_pointer, row: number): void;
export function duckdb_validity_set_row_valid(validity: uint64_pointer, row: number): void;
export function duckdb_appender_create(connection: duckdb_connection, schema: string, table: string, out_appender: duckdb_appender): Promise<duckdb_state>;
export function duckdb_appender_column_count(appender: duckdb_appender): number;
export function duckdb_appender_column_type(appender: duckdb_appender, col_idx: number): duckdb_logical_type;
Expand Down Expand Up @@ -313,14 +301,6 @@ export function duckdb_append_varchar_length(appender: duckdb_appender, val: str
export function duckdb_append_blob(appender: duckdb_appender, data: pointer, length: number): duckdb_state;
export function duckdb_append_null(appender: duckdb_appender): duckdb_state;
export function duckdb_append_data_chunk(appender: duckdb_appender, chunk: duckdb_data_chunk): duckdb_state;
export function duckdb_execute_tasks(database: duckdb_database, max_tasks: number): Promise<void>;
export function duckdb_create_task_state(database: duckdb_database): duckdb_task_state;
export function duckdb_execute_tasks_state(state: duckdb_task_state): void;
export function duckdb_execute_n_tasks_state(state: duckdb_task_state, max_tasks: number): number;
export function duckdb_finish_execution(state: duckdb_task_state): void;
export function duckdb_task_state_is_finished(state: duckdb_task_state): boolean;
export function duckdb_destroy_task_state(state: duckdb_task_state): void;
export function duckdb_execution_is_finished(con: duckdb_connection): boolean;
export function duckdb_fetch_chunk(result: duckdb_result): duckdb_data_chunk;
// bindings-defined constants
export const sizeof_bool: number;
Expand Down
2 changes: 2 additions & 0 deletions src/duckdb_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

static void *duckdb_node_dlopen_handle;

#define DUCKDB_NO_EXTENSION_FUNCTIONS
#define DUCKDB_API_NO_DEPRECATED

// this file contains generated template instantiations from duckdb.h
#include "duckdb_node_generated.cpp"

Expand Down
67 changes: 11 additions & 56 deletions src/duckdb_node_generated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ static void RegisterGenerated(Napi::Env env, Napi::Object exports,
exports.Set(
Napi::String::New(env, "duckdb_vector_get_validity"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<uint64_t*, duckdb_vector, "duckdb_vector_get_validity">>(env));
exports.Set(
Napi::String::New(env, "duckdb_vector_ensure_validity_writable"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1Void<duckdb_vector, "duckdb_vector_ensure_validity_writable">>(env));
exports.Set(
Napi::String::New(env, "duckdb_vector_assign_string_element"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper3Void<duckdb_vector, idx_t, const char*, "duckdb_vector_assign_string_element">>(env));
Expand All @@ -558,41 +561,17 @@ static void RegisterGenerated(Napi::Env env, Napi::Object exports,
Napi::String::New(env, "duckdb_array_vector_get_child"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<duckdb_vector, duckdb_vector, "duckdb_array_vector_get_child">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_get_extra_info"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<void*, duckdb_bind_info, "duckdb_bind_get_extra_info">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_add_result_column"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper3Void<duckdb_bind_info, const char*, duckdb_logical_type, "duckdb_bind_add_result_column">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_get_parameter_count"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<idx_t, duckdb_bind_info, "duckdb_bind_get_parameter_count">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_get_parameter"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2<duckdb_value, duckdb_bind_info, idx_t, "duckdb_bind_get_parameter">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_get_named_parameter"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2<duckdb_value, duckdb_bind_info, const char*, "duckdb_bind_get_named_parameter">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_set_cardinality"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper3Void<duckdb_bind_info, idx_t, bool, "duckdb_bind_set_cardinality">>(env));
exports.Set(
Napi::String::New(env, "duckdb_bind_set_error"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2Void<duckdb_bind_info, const char*, "duckdb_bind_set_error">>(env));
exports.Set(
Napi::String::New(env, "duckdb_function_get_extra_info"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<void*, duckdb_function_info, "duckdb_function_get_extra_info">>(env));
exports.Set(
Napi::String::New(env, "duckdb_function_get_bind_data"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<void*, duckdb_function_info, "duckdb_function_get_bind_data">>(env));
Napi::String::New(env, "duckdb_validity_row_is_valid"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2<bool, uint64_t*, idx_t, "duckdb_validity_row_is_valid">>(env));
exports.Set(
Napi::String::New(env, "duckdb_function_get_init_data"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<void*, duckdb_function_info, "duckdb_function_get_init_data">>(env));
Napi::String::New(env, "duckdb_validity_set_row_validity"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper3Void<uint64_t*, idx_t, bool, "duckdb_validity_set_row_validity">>(env));
exports.Set(
Napi::String::New(env, "duckdb_function_get_local_init_data"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<void*, duckdb_function_info, "duckdb_function_get_local_init_data">>(env));
Napi::String::New(env, "duckdb_validity_set_row_invalid"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2Void<uint64_t*, idx_t, "duckdb_validity_set_row_invalid">>(env));
exports.Set(
Napi::String::New(env, "duckdb_function_set_error"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2Void<duckdb_function_info, const char*, "duckdb_function_set_error">>(env));
Napi::String::New(env, "duckdb_validity_set_row_valid"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2Void<uint64_t*, idx_t, "duckdb_validity_set_row_valid">>(env));
exports.Set(
Napi::String::New(env, "duckdb_appender_create"),
Napi::Function::New<duckdb_node::FunctionWrappers::AsyncFunctionWrapper4<duckdb_state, duckdb_connection, const char*, const char*, duckdb_appender*, "duckdb_appender_create">>(env));
Expand Down Expand Up @@ -686,30 +665,6 @@ static void RegisterGenerated(Napi::Env env, Napi::Object exports,
exports.Set(
Napi::String::New(env, "duckdb_append_data_chunk"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2<duckdb_state, duckdb_appender, duckdb_data_chunk, "duckdb_append_data_chunk">>(env));
exports.Set(
Napi::String::New(env, "duckdb_execute_tasks"),
Napi::Function::New<duckdb_node::FunctionWrappers::AsyncFunctionWrapper2Void<duckdb_database, idx_t, "duckdb_execute_tasks">>(env));
exports.Set(
Napi::String::New(env, "duckdb_create_task_state"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<duckdb_task_state, duckdb_database, "duckdb_create_task_state">>(env));
exports.Set(
Napi::String::New(env, "duckdb_execute_tasks_state"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1Void<duckdb_task_state, "duckdb_execute_tasks_state">>(env));
exports.Set(
Napi::String::New(env, "duckdb_execute_n_tasks_state"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper2<idx_t, duckdb_task_state, idx_t, "duckdb_execute_n_tasks_state">>(env));
exports.Set(
Napi::String::New(env, "duckdb_finish_execution"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1Void<duckdb_task_state, "duckdb_finish_execution">>(env));
exports.Set(
Napi::String::New(env, "duckdb_task_state_is_finished"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<bool, duckdb_task_state, "duckdb_task_state_is_finished">>(env));
exports.Set(
Napi::String::New(env, "duckdb_destroy_task_state"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1Void<duckdb_task_state, "duckdb_destroy_task_state">>(env));
exports.Set(
Napi::String::New(env, "duckdb_execution_is_finished"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<bool, duckdb_connection, "duckdb_execution_is_finished">>(env));
exports.Set(
Napi::String::New(env, "duckdb_fetch_chunk"),
Napi::Function::New<duckdb_node::FunctionWrappers::FunctionWrapper1<duckdb_data_chunk, duckdb_result, "duckdb_fetch_chunk">>(env));
Expand Down

0 comments on commit 17333b0

Please sign in to comment.