lib/duckdb/result.rb in duckdb-0.9.2.3 vs lib/duckdb/result.rb in duckdb-0.10.0.0

- old
+ new

@@ -22,23 +22,36 @@ # result.each do |row| # p row # end class Result include Enumerable + TO_METHODS = if Gem::Version.new(DuckDB::LIBRARY_VERSION) >= Gem::Version.new('0.10.0') + Hash.new(:_to_string).merge( + 1 => :_to_boolean, + 3 => :_to_smallint, + 4 => :_to_integer, + 5 => :_to_bigint, + 10 => :_to_float, + 11 => :_to_double, + 16 => :_to_hugeint_internal, + 19 => :_to_blob, + 20 => :_to_decimal_internal + ).freeze + else + Hash.new(:_to_string).merge( + 1 => :_to_boolean, + 3 => :_to_smallint, + 4 => :_to_integer, + 5 => :_to_bigint, + 10 => :_to_float, + 11 => :_to_double, + 16 => :_to_hugeint_internal, + 18 => :_to_blob, + 19 => :_to_decimal_internal + ).freeze + end - TO_METHODS = Hash.new(:_to_string).merge( - 1 => :_to_boolean, - 3 => :_to_smallint, - 4 => :_to_integer, - 5 => :_to_bigint, - 10 => :_to_float, - 11 => :_to_double, - 16 => :_to_hugeint_internal, - 18 => :_to_blob, - 19 => :_to_decimal_internal - ).freeze - alias column_size column_count alias row_size row_count class << self def new @@ -112,9 +125,9 @@ BigDecimal(_to_string(row, col)) end def _to_decimal_internal(row, col) lower, upper, width, scale = __to_decimal_internal(row, col) - Converter._to_decimal_from_vector(width, scale, lower, upper) + Converter._to_decimal_from_hugeint(width, scale, upper, lower) end end end