提交 6c9cfd64 编写于 作者: J Jeremy Kemper

MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat. ...

MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat.  Eliminate usage of mysql.ping because it doesn't guarantee reconnect.  Explicitly close and reopen the connection instead.  References #428.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3216 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 4f1e37cc
*SVN*
* MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat. Eliminate usage of mysql.ping because it doesn't guarantee reconnect. Explicitly close and reopen the connection instead. [Jeremy Kemper]
* Added preliminary support for polymorphic associations [DHH]
* Added preliminary support for join models [DHH]
......
......@@ -155,18 +155,20 @@ def active?
else
@connection.query 'select 1'
end
true
# mysql-ruby doesn't raise an exception when stat fails.
if @connection.respond_to?(:errno)
@connection.errno.zero?
else
true
end
rescue Mysql::Error
false
end
def reconnect!
if @connection.respond_to?(:ping)
@connection.ping
else
@connection.close rescue nil
connect
end
@connection.close rescue nil
connect
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册