Ejemplo n.º 1
0
VALUE oci8_make_ocitimestamp(OCIDateTime *dttm, boolean have_tz)
{
    sb2 year;
    ub1 month;
    ub1 day;
    ub1 hour;
    ub1 minute;
    ub1 sec;
    ub4 fsec;
    sb1 tz_hour;
    sb1 tz_minute;

    chkerr(OCIDateTimeGetDate(oci8_envhp, oci8_errhp, dttm, &year, &month, &day));
    chkerr(OCIDateTimeGetTime(oci8_envhp, oci8_errhp, dttm, &hour, &minute, &sec, &fsec));
    if (have_tz) {
        chkerr(OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute));
    }
    return rb_ary_new3(9,
                       INT2FIX(year),
                       INT2FIX(month),
                       INT2FIX(day),
                       INT2FIX(hour),
                       INT2FIX(minute),
                       INT2FIX(sec),
                       INT2FIX(fsec),
                       have_tz ? INT2FIX(tz_hour) : Qnil,
                       have_tz ? INT2FIX(tz_minute) : Qnil);
}
Ejemplo n.º 2
0
 void Datetime::ociGetDate(sb2 &year, ub1 &month, ub1 &day) const
 {
   log_debug("OCIDateTimeGetDate(" << datetime << ')');
   sword ret = OCIDateTimeGetDate(conn->getEnvHandle(),
     conn->getErrorHandle(), datetime, &year, &month, &day);
   conn->checkError(ret, "OCIDateTimeGetDate");
 }
Ejemplo n.º 3
0
VALUE oci8_make_ocitimestamp_tz(OCIDateTime *dttm)
{
    sb2 year;
    ub1 month;
    ub1 day;
    ub1 hour;
    ub1 minute;
    ub1 sec;
    ub4 fsec;
    sb1 tz_hour;
    sb1 tz_minute;
    sword rv;
    int have_tz;

    oci_lc(OCIDateTimeGetDate(oci8_envhp, oci8_errhp, dttm, &year, &month, &day));
    oci_lc(OCIDateTimeGetTime(oci8_envhp, oci8_errhp, dttm, &hour, &minute, &sec, &fsec));
    rv = OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute);
    have_tz = (rv == OCI_SUCCESS);
    return rb_ary_new3(9,
                       INT2FIX(year),
                       INT2FIX(month),
                       INT2FIX(day),
                       INT2FIX(hour),
                       INT2FIX(minute),
                       INT2FIX(sec),
                       INT2FIX(fsec),
                       have_tz ? INT2FIX(tz_hour) : Qnil,
                       have_tz ? INT2FIX(tz_minute) : Qnil);
}