Module: DuckDB::Converter::IntToSym

Defined in:
lib/duckdb/converter/int_to_sym.rb

Constant Summary collapse

STATEMENT_TYPES =
%i[
  invalid
  select
  insert
  update
  explain
  delete
  prepare
  create
  execute
  alter
  transaction
  copy
  analyze
  variable_set
  create_func
  drop
  export
  pragma
  vacuum
  call
  set
  load
  relation
  extension
  logical_plan
  attach
  detach
  multi
].freeze
HASH_TYPES =
if Gem::Version.new(DuckDB::LIBRARY_VERSION) == Gem::Version.new('0.10.0')
  {
    0 => :invalid,
    1 => :boolean,
    2 => :tinyint,
    3 => :smallint,
    4 => :integer,
    5 => :bigint,
    6 => :utinyint,
    7 => :usmallint,
    8 => :uinteger,
    9 => :ubigint,
    10 => :float,
    11 => :double,
    12 => :timestamp,
    13 => :date,
    14 => :time,
    15 => :interval,
    16 => :hugeint,
    17 => :uhugeint,
    18 => :varchar,
    19 => :blob,
    20 => :decimal,
    21 => :timestamp_s,
    22 => :timestamp_ms,
    23 => :timestamp_ns,
    24 => :enum,
    25 => :list,
    26 => :struct,
    27 => :map,
    28 => :uuid,
    29 => :union,
    30 => :bit,
    31 => :time_tz,
    32 => :timestamp_tz
  }.freeze
else
  {
    0 => :invalid,
    1 => :boolean,
    2 => :tinyint,
    3 => :smallint,
    4 => :integer,
    5 => :bigint,
    6 => :utinyint,
    7 => :usmallint,
    8 => :uinteger,
    9 => :ubigint,
    10 => :float,
    11 => :double,
    12 => :timestamp,
    13 => :date,
    14 => :time,
    15 => :interval,
    16 => :hugeint,
    32 => :uhugeint,
    17 => :varchar,
    18 => :blob,
    19 => :decimal,
    20 => :timestamp_s,
    21 => :timestamp_ms,
    22 => :timestamp_ns,
    23 => :enum,
    24 => :list,
    25 => :struct,
    26 => :map,
    33 => :array,
    27 => :uuid,
    28 => :union,
    29 => :bit,
    30 => :time_tz,
    31 => :timestamp_tz
  }.freeze
end

Class Method Summary collapse

Class Method Details

.statement_type_to_sym(val) ⇒ Object

Raises:



114
115
116
117
118
# File 'lib/duckdb/converter/int_to_sym.rb', line 114

def statement_type_to_sym(val)
  raise DuckDB::Error, "Unknown statement type: #{val}" if val >= STATEMENT_TYPES.size

  STATEMENT_TYPES[val]
end

.type_to_sym(val) ⇒ Object

Raises:



120
121
122
123
124
# File 'lib/duckdb/converter/int_to_sym.rb', line 120

def type_to_sym(val)
  raise DuckDB::Error, "Unknown type: #{val}" unless HASH_TYPES.key?(val)

  HASH_TYPES[val]
end