class DuckDB::Column
Public Instance Methods
Source
VALUE duckdb_column__logical_type(VALUE oDuckDBColumn) { rubyDuckDBColumn *ctx; rubyDuckDBResult *ctxresult; VALUE result; duckdb_logical_type _logical_type; VALUE logical_type = Qnil; TypedData_Get_Struct(oDuckDBColumn, rubyDuckDBColumn, &column_data_type, ctx); result = rb_ivar_get(oDuckDBColumn, rb_intern("result")); ctxresult = get_struct_result(result); _logical_type = duckdb_column_logical_type(&(ctxresult->result), ctx->col); if (_logical_type) { logical_type = rbduckdb_create_logical_type(_logical_type); } return logical_type; }
Returns the logical type class.
Source
VALUE duckdb_column_get_name(VALUE oDuckDBColumn) { rubyDuckDBColumn *ctx; VALUE result; rubyDuckDBResult *ctxresult; TypedData_Get_Struct(oDuckDBColumn, rubyDuckDBColumn, &column_data_type, ctx); result = rb_ivar_get(oDuckDBColumn, rb_intern("result")); ctxresult = get_struct_result(result); return rb_utf8_str_new_cstr(duckdb_column_name(&(ctxresult->result), ctx->col)); }
Returns the column name.
Source
# File lib/duckdb/column.rb, line 17 def type type_id = _type DuckDB::Converter::IntToSym.type_to_sym(type_id) end
returns column type symbol ‘:unknown` means that the column type is unknown/unsupported by ruby-duckdb. `:invalid` means that the column type is invalid in duckdb.
require 'duckdb' db = DuckDB::Database.open con = db.connect con.query('CREATE TABLE users (id INTEGER, name VARCHAR(30))') users = con.query('SELECT * FROM users') columns = users.columns columns.first.type #=> :integer