class DuckDB::TableFunction::FunctionInfo
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 Lint/EmptyClass
Public Instance Methods
Source
static VALUE table_function_function_info_get_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);
}
Returns the object stored during the bind phase with DuckDB::TableFunction::BindInfo#set_bind_data, or nil if none was set.
data = function_info.get_bind_data
Source
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;
}
Sets an error message for the function execution. This will cause the query to fail with the specified error.
function_info.set_error('Invalid parameter value')