forked from radar/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that microsecond precision is only used for version of mysql t…
…hat support it. Fixes rails#19711
- Loading branch information
1 parent
a2bb266
commit e975d7c
Showing
6 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "cases/helper" | ||
|
||
class Mysql2QuotingTest < ActiveRecord::Mysql2TestCase | ||
setup do | ||
@connection = ActiveRecord::Base.connection | ||
end | ||
|
||
test 'quoted date precision for gte 5.6.4' do | ||
@connection.stubs(:full_version).returns('5.6.4') | ||
@connection.remove_instance_variable(:@version) | ||
t = Time.now.change(usec: 1) | ||
assert_match(/\.000001\z/, @connection.quoted_date(t)) | ||
end | ||
|
||
test 'quoted date precision for lt 5.6.4' do | ||
@connection.stubs(:full_version).returns('5.6.3') | ||
@connection.remove_instance_variable(:@version) | ||
t = Time.now.change(usec: 1) | ||
refute_match(/\.000001\z/, @connection.quoted_date(t)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters