MySQL: fix show_variable. Closes #8448.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7071 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
e963354124
commit
eb2e30ef24
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* MySQL: fix show_variable. #8448 [matt, Jeremy Kemper]
|
||||
|
||||
* Fixtures: correctly delete and insert fixtures in a single transaction. #8553 [Michael Schuerig]
|
||||
|
||||
* Fixtures: people(:technomancy, :josh) returns both fixtures. #7880 [technomancy, Josh Peek]
|
||||
|
|
|
@ -409,7 +409,8 @@ module ActiveRecord
|
|||
|
||||
# SHOW VARIABLES LIKE 'name'
|
||||
def show_variable(name)
|
||||
select_value "SHOW VARIABLES LIKE '#{name}'"
|
||||
variables = select_all("SHOW VARIABLES LIKE '#{name}'")
|
||||
variables.first['Value'] unless variables.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -48,11 +48,19 @@ class AdapterTest < Test::Unit::TestCase
|
|||
|
||||
if current_adapter?(:MysqlAdapter)
|
||||
def test_charset
|
||||
assert @connection.charset
|
||||
assert_not_nil @connection.charset
|
||||
assert_not_equal 'character_set_database', @connection.charset
|
||||
assert_equal @connection.show_variable('character_set_database'), @connection.charset
|
||||
end
|
||||
|
||||
def test_collation
|
||||
assert @connection.collation
|
||||
assert_not_nil @connection.collation
|
||||
assert_not_equal 'collation_database', @connection.collation
|
||||
assert_equal @connection.show_variable('collation_database'), @connection.collation
|
||||
end
|
||||
|
||||
def test_show_nonexistent_variable_returns_nil
|
||||
assert_nil @connection.show_variable('foo_bar_baz')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue