ext/duckdb/result.c in duckdb-0.9.2 vs ext/duckdb/result.c in duckdb-0.9.2.1

- old
+ new

@@ -42,10 +42,11 @@ static VALUE duckdb_result__enum_dictionary_size(VALUE oDuckDBResult, VALUE col_idx); static VALUE duckdb_result__enum_dictionary_value(VALUE oDuckDBResult, VALUE col_idx, VALUE idx); static VALUE vector_date(void *vector_data, idx_t row_idx); static VALUE vector_timestamp(void* vector_data, idx_t row_idx); +static VALUE vector_time(void* vector_data, idx_t row_idx); static VALUE vector_interval(void* vector_data, idx_t row_idx); static VALUE vector_blob(void* vector_data, idx_t row_idx); static VALUE vector_varchar(void* vector_data, idx_t row_idx); static VALUE vector_hugeint(void* vector_data, idx_t row_idx); static VALUE vector_decimal(duckdb_logical_type ty, void* vector_data, idx_t row_idx); @@ -499,10 +500,21 @@ INT2FIX(data.time.sec), INT2NUM(data.time.micros) ); } +static VALUE vector_time(void* vector_data, idx_t row_idx) { + duckdb_time_struct data = duckdb_from_time(((duckdb_time *)vector_data)[row_idx]); + return rb_funcall(mDuckDBConverter, rb_intern("_to_time_from_duckdb_time"), 4, + INT2FIX(data.hour), + INT2FIX(data.min), + INT2FIX(data.sec), + INT2NUM(data.micros) + ); +} + + static VALUE vector_interval(void* vector_data, idx_t row_idx) { duckdb_interval data = ((duckdb_interval *)vector_data)[row_idx]; return rb_funcall(mDuckDBConverter, rb_intern("_to_interval_from_vector"), 3, INT2NUM(data.months), INT2NUM(data.days), @@ -718,9 +730,12 @@ case DUCKDB_TYPE_DATE: obj = vector_date(vector_data, row_idx); break; case DUCKDB_TYPE_TIMESTAMP: obj = vector_timestamp(vector_data, row_idx); + break; + case DUCKDB_TYPE_TIME: + obj = vector_time(vector_data, row_idx); break; case DUCKDB_TYPE_INTERVAL: obj = vector_interval(vector_data, row_idx); break; case DUCKDB_TYPE_VARCHAR: