class DuckDB::Result
end
p row
result.each do |row|
result = con.execute(‘SELECT * from users’)
con.execute(“INSERT into users VALUES(3, ‘Cathy’)”)
con.execute(“INSERT into users VALUES(2, ‘Bob’)”)
con.execute(“INSERT into users VALUES(1, ‘Alice’)”)
con.execute(‘CREATE TABLE users (id INTEGER, name VARCHAR(30))’)
con = db.connect
db = DuckDB::Database.open # database in memory
require ‘duckdb’
The usage is as follows:
The Result class encapsulates a execute result of DuckDB database.
def each(&)
def each(&) return _chunk_stream unless block_given? _chunk_stream(&) end
def enum_dictionary_values(col_index)
result = con.query('SELECT * FROM enums')
con.execute("CREATE TABLE enums (id INTEGER, mood mood)")
con.execute("CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '𝘾𝝾օɭ 😎')")
con = db.connect
db = DuckDB::Database.open('duckdb_database')
require 'duckdb'
returns all available ENUM type values of the specified column index.
def enum_dictionary_values(col_index) values = [] _enum_dictionary_size(col_index).times do |i| values << _enum_dictionary_value(col_index, i) end values end
def new
def new raise DuckDB::Error, 'DuckDB::Result cannot be instantiated directly.' end
def return_type
result = con.execute('CREATE TABLE users (id INTEGER, name VARCHAR(30))')
con = db.connect
db = DuckDB::Database.open('duckdb_database')
require 'duckdb'
:invalid, :changed_rows, :nothing, :query_result
returns return type. The return value is one of the following symbols:
def return_type i = _return_type raise DuckDB::Error, "Unknown return type: #{i}" if i >= RETURN_TYPES.size RETURN_TYPES[i] end
def statement_type
result = con.execute('CREATE TABLE users (id INTEGER, name VARCHAR(30))')
con = db.connect
db = DuckDB::Database.open('duckdb_database')
require 'duckdb'
:logical_plan, :attach, :detach, :multi
:drop, :export, :pragma, :vacuum, :call, :set, :load, :relation, :extension,
:execute, :alter, :transaction, :copy, :analyze, :variable_set, :create_func,
:invalid, :select, :insert, :update, :explain, :delete, :prepare, :create,
returns statement type. The return value is one of the following symbols:
def statement_type i = _statement_type Converter::IntToSym.statement_type_to_sym(i) end