ext/duckdb/appender.c in duckdb-1.0.0.0 vs ext/duckdb/appender.c in duckdb-1.0.0.1

- old
+ new

@@ -26,10 +26,11 @@ static VALUE appender__append_date(VALUE self, VALUE yearval, VALUE monthval, VALUE dayval); static VALUE appender__append_interval(VALUE self, VALUE months, VALUE days, VALUE micros); static VALUE appender__append_time(VALUE self, VALUE hour, VALUE min, VALUE sec, VALUE micros); static VALUE appender__append_timestamp(VALUE self, VALUE year, VALUE month, VALUE day, VALUE hour, VALUE min, VALUE sec, VALUE micros); static VALUE appender__append_hugeint(VALUE self, VALUE lower, VALUE upper); +static VALUE appender__append_uhugeint(VALUE self, VALUE lower, VALUE upper); static VALUE appender_flush(VALUE self); static VALUE appender_close(VALUE self); static const rb_data_type_t appender_data_type = { "DuckDB/Appender", @@ -347,10 +348,25 @@ rb_raise(eDuckDBError, "failed to append hugeint"); } return self; } +static VALUE appender__append_uhugeint(VALUE self, VALUE lower, VALUE upper) { + duckdb_uhugeint uhugeint; + + uhugeint.lower = NUM2ULL(lower); + uhugeint.upper = NUM2ULL(upper); + + rubyDuckDBAppender *ctx; + + TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx); + if (duckdb_append_uhugeint(ctx->appender, uhugeint) == DuckDBError) { + rb_raise(eDuckDBError, "failed to append uhugeint"); + } + return self; +} + static VALUE appender_flush(VALUE self) { rubyDuckDBAppender *ctx; TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx); if (duckdb_appender_flush(ctx->appender) == DuckDBError) { @@ -393,8 +409,9 @@ rb_define_private_method(cDuckDBAppender, "_append_date", appender__append_date, 3); rb_define_private_method(cDuckDBAppender, "_append_interval", appender__append_interval, 3); rb_define_private_method(cDuckDBAppender, "_append_time", appender__append_time, 4); rb_define_private_method(cDuckDBAppender, "_append_timestamp", appender__append_timestamp, 7); rb_define_private_method(cDuckDBAppender, "_append_hugeint", appender__append_hugeint, 2); + rb_define_private_method(cDuckDBAppender, "_append_uhugeint", appender__append_uhugeint, 2); rb_define_method(cDuckDBAppender, "flush", appender_flush, 0); rb_define_method(cDuckDBAppender, "close", appender_close, 0); }