Class: DuckDB::TableFunction::FunctionInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/duckdb/table_function/function_info.rb,
ext/duckdb/table_function_function_info.c

Overview

The DuckDB::TableFunction::FunctionInfo provides context during table function execution.

It is passed to the execute callback along with the output DataChunk.

Example:

table_function.execute do |func_info, output|
# Report errors during execution
func_info.set_error('Something went wrong')
end

rubocop:disable-next Lint/EmptyClass

Instance Method Summary collapse

Instance Method Details

#bind_dataObject



46
47
48
49
50
51
52
53
54
55
# File 'ext/duckdb/table_function_function_info.c', line 46

static VALUE table_function_function_info_bind_data(VALUE self) {
    rubyDuckDBFunctionInfo *ctx;
    void *bind_data;

    TypedData_Get_Struct(self, rubyDuckDBFunctionInfo, &function_info_data_type, ctx);

    bind_data = duckdb_function_get_bind_data(ctx->info);

    return rbduckdb_function_data_lookup(bind_data);
}

#set_error(error) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
# File 'ext/duckdb/table_function_function_info.c', line 66

static VALUE table_function_function_info_set_error(VALUE self, VALUE error) {
    rubyDuckDBFunctionInfo *ctx;
    const char *error_msg;

    TypedData_Get_Struct(self, rubyDuckDBFunctionInfo, &function_info_data_type, ctx);

    error_msg = StringValueCStr(error);
    duckdb_function_set_error(ctx->info, error_msg);

    return self;
}