Class: DuckDB::TableFunction::InitInfo
- Inherits:
-
Object
- Object
- DuckDB::TableFunction::InitInfo
- Defined in:
- lib/duckdb/table_function/init_info.rb,
ext/duckdb/table_function_init_info.c
Overview
The DuckDB::TableFunction::InitInfo provides context during table function initialization.
It is passed to the init callback to set up execution state.
Example:
table_function.init do |init_info|
# Initialize execution state
# Can report errors if initialization fails
init_info.set_error('Initialization failed')
end
rubocop:disable-next Lint/EmptyClass
Instance Method Summary collapse
- #bind_data ⇒ Object
- #column_count ⇒ Object
- #column_index(index) ⇒ Object
- #max_threads=(max_threads) ⇒ Object
- #set_error(error) ⇒ Object
- #set_max_threads(max_threads) ⇒ Object
Instance Method Details
#bind_data ⇒ Object
128 129 130 131 132 133 134 |
# File 'ext/duckdb/table_function_init_info.c', line 128
static VALUE table_function_init_info_bind_data(VALUE self) {
rubyDuckDBInitInfo *ctx;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
return rbduckdb_function_data_lookup(duckdb_init_get_bind_data(ctx->info));
}
|
#column_count ⇒ Object
92 93 94 95 96 97 98 |
# File 'ext/duckdb/table_function_init_info.c', line 92
static VALUE table_function_init_info_column_count(VALUE self) {
rubyDuckDBInitInfo *ctx;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
return ULL2NUM(duckdb_init_get_column_count(ctx->info));
}
|
#column_index(index) ⇒ Object
111 112 113 114 115 116 117 |
# File 'ext/duckdb/table_function_init_info.c', line 111
static VALUE table_function_init_info_column_index(VALUE self, VALUE index) {
rubyDuckDBInitInfo *ctx;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
return ULL2NUM(duckdb_init_get_column_index(ctx->info, NUM2ULL(index)));
}
|
#max_threads=(max_threads) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'ext/duckdb/table_function_init_info.c', line 72
static VALUE table_function_init_info_set_max_threads(VALUE self, VALUE max_threads) {
rubyDuckDBInitInfo *ctx;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
duckdb_init_set_max_threads(ctx->info, NUM2ULL(max_threads));
return self;
}
|
#set_error(error) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'ext/duckdb/table_function_init_info.c', line 49
static VALUE table_function_init_info_set_error(VALUE self, VALUE error) {
rubyDuckDBInitInfo *ctx;
const char *error_msg;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
error_msg = StringValueCStr(error);
duckdb_init_set_error(ctx->info, error_msg);
return self;
}
|
#set_max_threads(max_threads) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'ext/duckdb/table_function_init_info.c', line 72
static VALUE table_function_init_info_set_max_threads(VALUE self, VALUE max_threads) {
rubyDuckDBInitInfo *ctx;
TypedData_Get_Struct(self, rubyDuckDBInitInfo, &init_info_data_type, ctx);
duckdb_init_set_max_threads(ctx->info, NUM2ULL(max_threads));
return self;
}
|