// [[Rcpp::export]] List Datetime_get_functions(Datetime x) { Datetime dt = Datetime(x); return List::create(Named("year") = dt.getYear(), Named("month") = dt.getMonth(), Named("day") = dt.getDay(), Named("wday") = dt.getWeekday(), Named("hour") = dt.getHours(), Named("minute") = dt.getMinutes(), Named("second") = dt.getSeconds(), Named("microsec") = dt.getMicroSeconds()); }
void setDatetime(MYSQL_BIND& bind, const Datetime& data) { reserve(bind, sizeof(MYSQL_TIME)); memset(bind.buffer, 0, sizeof(MYSQL_TIME)); MYSQL_TIME* ts = static_cast<MYSQL_TIME*>(bind.buffer); ts->year = data.getYear(); ts->month = data.getMonth(); ts->day = data.getDay(); ts->hour = data.getHour(); ts->minute = data.getMinute(); ts->second = data.getSecond(); bind.buffer_type = MYSQL_TYPE_DATE; bind.is_null = 0; }