Skip to content

Commit

Permalink
Test prepared statements in the prepared statements tests: date & time
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Nov 14, 2017
1 parent cffb76d commit 255c759
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/mysql2/statement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,39 +460,39 @@ def stmt_count

it "should return DateTime when timestamp is < 1901-12-13 20:45:52" do
# 1901-12-13T20:45:52 is the min for 32bit Ruby 1.8
r = @client.query("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(klass)
end

it "should return DateTime when timestamp is > 2038-01-19T03:14:07" do
# 2038-01-19T03:14:07 is the max for 32bit Ruby 1.8
r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(klass)
end
elsif 1.size == 8 # 64bit
if RUBY_VERSION =~ /1.8/
it "should return Time when timestamp is > 0138-12-31 11:59:59" do
r = @client.query("SELECT CAST('0139-1-1 00:00:00' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('0139-1-1 00:00:00' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(Time)
end

it "should return DateTime when timestamp is < 0139-1-1T00:00:00" do
r = @client.query("SELECT CAST('0138-12-31 11:59:59' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('0138-12-31 11:59:59' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(DateTime)
end

it "should return Time when timestamp is > 2038-01-19T03:14:07" do
r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(Time)
end
else
it "should return Time when timestamp is < 1901-12-13 20:45:52" do
r = @client.query("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(Time)
end

it "should return Time when timestamp is > 2038-01-19T03:14:07" do
r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
r = @client.prepare("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test").execute
expect(r.first['test']).to be_an_instance_of(Time)
end
end
Expand Down

0 comments on commit 255c759

Please sign in to comment.