Skip to content

Commit 02ea1b1

Browse files
committed
fix time out range error in ruby 1.8.7
1 parent ec36b1f commit 02ea1b1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ext/mysql2/result.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
static rb_encoding *binaryEncoding;
55
#endif
66

7-
#define MYSQL2_MAX_YEAR 2058
7+
#define MYSQL2_MAX_YEAR 2038
88

99
#ifdef NEGATIVE_TIME_T
1010
/* 1901-12-13 20:45:52 UTC : The oldest time in 32-bit signed time_t. */

spec/mysql2/result_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@
173173
r.first['test'].class.should eql(DateTime)
174174
end
175175

176+
it "should return DateTime when time > year 2038" do
177+
r = @client.query("SELECT CAST('2039-01-01 01:01:01' AS DATETIME) as test")
178+
r.first['test'].class.should eql(DateTime)
179+
end
180+
176181
it "should return Time for a TIMESTAMP value when within the supported range" do
177182
@test_result['timestamp_test'].class.should eql(Time)
178183
@test_result['timestamp_test'].strftime("%F %T").should eql('2010-04-04 11:44:00')

0 commit comments

Comments
 (0)