Sha256: 8386adf0666b5a3bc2cdcc822eeb82bd23b439b02c37443a44b321479faa58be

Contents?: true

Size: 1.34 KB

Versions: 19

Compression:

Stored size: 1.34 KB

Contents

#include "ruby-duckdb.h"

duckdb_date rbduckdb_to_duckdb_date_from_value(VALUE year, VALUE month, VALUE day) {
    duckdb_date_struct dt_struct;

    dt_struct.year = NUM2INT(year);
    dt_struct.month = NUM2INT(month);
    dt_struct.day = NUM2INT(day);

    return duckdb_to_date(dt_struct);
}

duckdb_time rbduckdb_to_duckdb_time_from_value(VALUE hour, VALUE min, VALUE sec, VALUE micros) {
    duckdb_time_struct time_st;

    time_st.hour = NUM2INT(hour);
    time_st.min = NUM2INT(min);
    time_st.sec = NUM2INT(sec);
    time_st.micros = NUM2INT(micros);

    return duckdb_to_time(time_st);
}

duckdb_timestamp rbduckdb_to_duckdb_timestamp_from_value(VALUE year, VALUE month, VALUE day, VALUE hour, VALUE min, VALUE sec, VALUE micros) {
    duckdb_timestamp_struct timestamp_st;

    timestamp_st.date.year = NUM2INT(year);
    timestamp_st.date.month = NUM2INT(month);
    timestamp_st.date.day = NUM2INT(day);
    timestamp_st.time.hour = NUM2INT(hour);
    timestamp_st.time.min = NUM2INT(min);
    timestamp_st.time.sec = NUM2INT(sec);
    timestamp_st.time.micros = NUM2INT(micros);

    return duckdb_to_timestamp(timestamp_st);
}

void rbduckdb_to_duckdb_interval_from_value(duckdb_interval* interval, VALUE months, VALUE days, VALUE micros) {
    interval->months = NUM2INT(months);
    interval->days = NUM2INT(days);
    interval->micros = NUM2LL(micros);
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
duckdb-1.1.3.1 ext/duckdb/util.c
duckdb-1.1.3.0 ext/duckdb/util.c
duckdb-1.1.2.1 ext/duckdb/util.c
duckdb-1.1.2.0 ext/duckdb/util.c
duckdb-1.1.1.0 ext/duckdb/util.c
duckdb-1.1.0.1 ext/duckdb/util.c
duckdb-1.1.0.0 ext/duckdb/util.c
duckdb-1.0.0.2 ext/duckdb/util.c
duckdb-1.0.0.1 ext/duckdb/util.c
duckdb-1.0.0.0 ext/duckdb/util.c
duckdb-0.10.2.0 ext/duckdb/util.c
duckdb-0.10.1.1 ext/duckdb/util.c
duckdb-0.10.1.0 ext/duckdb/util.c
duckdb-0.10.0.0 ext/duckdb/util.c
duckdb-0.9.2.3 ext/duckdb/util.c
duckdb-0.9.2.2 ext/duckdb/util.c
duckdb-0.9.2.1 ext/duckdb/util.c
duckdb-0.9.2 ext/duckdb/util.c
duckdb-0.9.1.2 ext/duckdb/util.c