lib/duckdb/converter.rb in duckdb-0.5.1.1 vs lib/duckdb/converter.rb in duckdb-0.6.1

- old
+ new

@@ -1,7 +1,20 @@ module DuckDB module Converter + HALF_HUGEINT = 1 << 64 + private + + def integer_to_hugeint(value) + case value + when Integer + upper = value / HALF_HUGEINT + lower = value - upper * HALF_HUGEINT + [lower, upper] + else + raise(ArgumentError, "2nd argument `#{value}` must be Integer.") + end + end def iso8601_interval_to_hash(value) digit = '' time = false hash = {}