]>
Commit | Line | Data |
---|---|---|
66440407 | 1 | Index: mysql.c |
0f5cb7f6 | 2 | =================================================================== |
66440407 JR |
3 | --- mysql.c.orig |
4 | +++ mysql.c | |
0f5cb7f6 | 5 | @@ -1362,6 +1362,7 @@ static VALUE stmt_execute(int argc, VALU |
66440407 JR |
6 | t.day = FIX2INT(RARRAY_PTR(a)[3]); |
7 | t.month = FIX2INT(RARRAY_PTR(a)[4]); | |
8 | t.year = FIX2INT(RARRAY_PTR(a)[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; | |
0f5cb7f6 | 13 | @@ -1375,6 +1376,7 @@ static VALUE stmt_execute(int argc, VALU |
66440407 JR |
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,26 +1702,26 @@ static VALUE time_initialize(int argc, V | |
0f5cb7f6 | 22 | static VALUE time_inspect(VALUE obj) |
23 | { | |
24 | char buf[36]; | |
25 | - sprintf(buf, "#<Mysql::Time:%04d-%02d-%02d %02d:%02d:%02d>", | |
26 | - NUM2INT(rb_iv_get(obj, "year")), | |
27 | - NUM2INT(rb_iv_get(obj, "month")), | |
28 | - NUM2INT(rb_iv_get(obj, "day")), | |
29 | - NUM2INT(rb_iv_get(obj, "hour")), | |
30 | - NUM2INT(rb_iv_get(obj, "minute")), | |
31 | - NUM2INT(rb_iv_get(obj, "second"))); | |
32 | + sprintf(buf, "#<Mysql::Time:%04ld-%02ld-%02ld %02ld:%02ld:%02ld>", | |
33 | + NUM2LONG(rb_iv_get(obj, "year")), | |
34 | + NUM2LONG(rb_iv_get(obj, "month")), | |
35 | + NUM2LONG(rb_iv_get(obj, "day")), | |
36 | + NUM2LONG(rb_iv_get(obj, "hour")), | |
37 | + NUM2LONG(rb_iv_get(obj, "minute")), | |
38 | + NUM2LONG(rb_iv_get(obj, "second"))); | |
39 | return rb_str_new2(buf); | |
40 | } | |
41 | ||
42 | static VALUE time_to_s(VALUE obj) | |
43 | { | |
44 | char buf[20]; | |
45 | - sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", | |
46 | - NUM2INT(rb_iv_get(obj, "year")), | |
47 | - NUM2INT(rb_iv_get(obj, "month")), | |
48 | - NUM2INT(rb_iv_get(obj, "day")), | |
49 | - NUM2INT(rb_iv_get(obj, "hour")), | |
50 | - NUM2INT(rb_iv_get(obj, "minute")), | |
51 | - NUM2INT(rb_iv_get(obj, "second"))); | |
52 | + sprintf(buf, "%04ld-%02ld-%02ld %02ld:%02ld:%02ld", | |
53 | + NUM2LONG(rb_iv_get(obj, "year")), | |
54 | + NUM2LONG(rb_iv_get(obj, "month")), | |
55 | + NUM2LONG(rb_iv_get(obj, "day")), | |
56 | + NUM2LONG(rb_iv_get(obj, "hour")), | |
57 | + NUM2LONG(rb_iv_get(obj, "minute")), | |
58 | + NUM2LONG(rb_iv_get(obj, "second"))); | |
59 | return rb_str_new2(buf); | |
60 | } | |
61 |