use a default (year 2000) for TIME field casting to a Time object, like AR does

This commit is contained in:
Brian Lopez 2010-08-01 20:23:27 -07:00
parent 36c243be71
commit 6142336e59

View File

@ -158,7 +158,7 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, VALUE opts) {
case MYSQL_TYPE_TIME: { // TIME field case MYSQL_TYPE_TIME: { // TIME field
int hour, min, sec, tokens; int hour, min, sec, tokens;
tokens = sscanf(row[i], "%2d:%2d:%2d", &hour, &min, &sec); tokens = sscanf(row[i], "%2d:%2d:%2d", &hour, &min, &sec);
val = rb_funcall(rb_cTime, intern_utc, 6, INT2NUM(0), INT2NUM(1), INT2NUM(1), INT2NUM(hour), INT2NUM(min), INT2NUM(sec)); val = rb_funcall(rb_cTime, intern_utc, 6, INT2NUM(2000), INT2NUM(1), INT2NUM(1), INT2NUM(hour), INT2NUM(min), INT2NUM(sec));
break; break;
} }
case MYSQL_TYPE_TIMESTAMP: // TIMESTAMP field case MYSQL_TYPE_TIMESTAMP: // TIMESTAMP field