lib/duckdb/appender.rb in duckdb-0.8.1.3 vs lib/duckdb/appender.rb in duckdb-0.9.0

- old
+ new

@@ -148,17 +148,12 @@ # .append_interval('P1Y2D') # => append 1 year 2 days interval. # .end_row # .flush # def append_interval(value) - raise ArgumentError, "Argument `#{value}` must be a string." unless value.is_a?(String) - - hash = iso8601_interval_to_hash(value) - - months, days, micros = hash_to__append_interval_args(hash) - - _append_interval(months, days, micros) + value = Interval.to_interval(value) + _append_interval(value.interval_months, value.interval_days, value.interval_micros) end # # appends value. # @@ -195,9 +190,11 @@ append_bool(value) when Time append_timestamp(value) when Date append_date(value) + when DuckDB::Interval + append_interval(value) else raise(DuckDB::Error, "not supported type #{value} (#{value.class})") end end