]>
Commit | Line | Data |
---|---|---|
0f5cb7f6 | 1 | Index: mysql.c.in |
2 | =================================================================== | |
3 | --- mysql.c.in.orig | |
4 | +++ mysql.c.in | |
5 | @@ -1362,6 +1362,7 @@ static VALUE stmt_execute(int argc, VALU | |
6 | t.day = FIX2INT(RARRAY(a)->ptr[3]); | |
7 | t.month = FIX2INT(RARRAY(a)->ptr[4]); | |
8 | t.year = FIX2INT(RARRAY(a)->ptr[5]); | |
9 | + t.time_type = MYSQL_TYPE_DATETIME; | |
10 | *(MYSQL_TIME*)&(s->param.buffer[i]) = t; | |
11 | } else if (CLASS_OF(argv[i]) == cMysqlTime) { | |
12 | MYSQL_TIME t; | |
13 | @@ -1375,6 +1376,7 @@ static VALUE stmt_execute(int argc, VALU | |
14 | t.day = NUM2INT(rb_iv_get(argv[i], "day")); | |
15 | t.month = NUM2INT(rb_iv_get(argv[i], "month")); | |
16 | t.year = NUM2INT(rb_iv_get(argv[i], "year")); | |
17 | + t.time_type = MYSQL_TYPE_DATETIME; | |
18 | *(MYSQL_TIME*)&(s->param.buffer[i]) = t; | |
19 | } else | |
20 | rb_raise(rb_eTypeError, "unsupported type: %d", TYPE(argv[i])); | |
21 | @@ -1700,31 +1702,32 @@ static VALUE time_initialize(int argc, V | |
22 | rb_iv_set(obj, "second", NILorFIXvalue(second)); | |
23 | rb_iv_set(obj, "neg", (neg == Qnil || neg == Qfalse) ? Qfalse : Qtrue); | |
24 | rb_iv_set(obj, "second_part", NILorFIXvalue(second_part)); | |
25 | + return obj; | |
26 | } | |
27 | ||
28 | static VALUE time_inspect(VALUE obj) | |
29 | { | |
30 | char buf[36]; | |
31 | - sprintf(buf, "#<Mysql::Time:%04d-%02d-%02d %02d:%02d:%02d>", | |
32 | - NUM2INT(rb_iv_get(obj, "year")), | |
33 | - NUM2INT(rb_iv_get(obj, "month")), | |
34 | - NUM2INT(rb_iv_get(obj, "day")), | |
35 | - NUM2INT(rb_iv_get(obj, "hour")), | |
36 | - NUM2INT(rb_iv_get(obj, "minute")), | |
37 | - NUM2INT(rb_iv_get(obj, "second"))); | |
38 | + sprintf(buf, "#<Mysql::Time:%04ld-%02ld-%02ld %02ld:%02ld:%02ld>", | |
39 | + NUM2LONG(rb_iv_get(obj, "year")), | |
40 | + NUM2LONG(rb_iv_get(obj, "month")), | |
41 | + NUM2LONG(rb_iv_get(obj, "day")), | |
42 | + NUM2LONG(rb_iv_get(obj, "hour")), | |
43 | + NUM2LONG(rb_iv_get(obj, "minute")), | |
44 | + NUM2LONG(rb_iv_get(obj, "second"))); | |
45 | return rb_str_new2(buf); | |
46 | } | |
47 | ||
48 | static VALUE time_to_s(VALUE obj) | |
49 | { | |
50 | char buf[20]; | |
51 | - sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", | |
52 | - NUM2INT(rb_iv_get(obj, "year")), | |
53 | - NUM2INT(rb_iv_get(obj, "month")), | |
54 | - NUM2INT(rb_iv_get(obj, "day")), | |
55 | - NUM2INT(rb_iv_get(obj, "hour")), | |
56 | - NUM2INT(rb_iv_get(obj, "minute")), | |
57 | - NUM2INT(rb_iv_get(obj, "second"))); | |
58 | + sprintf(buf, "%04ld-%02ld-%02ld %02ld:%02ld:%02ld", | |
59 | + NUM2LONG(rb_iv_get(obj, "year")), | |
60 | + NUM2LONG(rb_iv_get(obj, "month")), | |
61 | + NUM2LONG(rb_iv_get(obj, "day")), | |
62 | + NUM2LONG(rb_iv_get(obj, "hour")), | |
63 | + NUM2LONG(rb_iv_get(obj, "minute")), | |
64 | + NUM2LONG(rb_iv_get(obj, "second"))); | |
65 | return rb_str_new2(buf); | |
66 | } | |
67 |