提交 ce0bd685 编写于 作者: R Rafael Mendonça França

Merge pull request #21318 from yahonda/pr21108

Support MySQL 5.7.8 which enables show_compatibility_56=off
......@@ -727,8 +727,12 @@ def type_to_sql(type, limit = nil, precision = nil, scale = nil)
# SHOW VARIABLES LIKE 'name'
def show_variable(name)
variables = select_all("SHOW VARIABLES LIKE '#{name}'", 'SCHEMA')
variables.first['Value'] unless variables.empty?
begin
variables = select_all("select @@#{name} as 'Value'", 'SCHEMA')
variables.first['Value'] unless variables.empty?
rescue ActiveRecord::StatementInvalid => _e
nil
end
end
# Returns a table's primary key and belonging sequence.
......
......@@ -223,7 +223,7 @@ def client_encoding
return @client_encoding if @client_encoding
result = exec_query(
"SHOW VARIABLES WHERE Variable_name = 'character_set_client'",
"select @@character_set_client",
'SCHEMA')
@client_encoding = ENCODINGS[result.rows.last.last]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册