ruby与rails版本差异不能连接mysql

由于ruby与rails版本差异,可能会出现在使用低版本的rails时,出现不能连接mysql的情况。
现象:ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `initialize’: wrong number of arguments (1 for 0) (ArgumentError)

解决方法
def scramble41(password, message)
return 0×00.chr if password.nil? or password.empty?
buf = [0x14]
#s1 = Digest::SHA1.new(password).digest
s1 = Digest::SHA1.new
s1 << password
s1 = s1.digest
#s2 = Digest::SHA1.new(s1).digest
s2 = Digest::SHA1.new << s1
s2 = s2.digest
#x = Digest::SHA1.new(message + s2).digest
x = Digest::SHA1.new << (message + s2)
x = x.digest
(0..s1.length – 1).each {|i| buf.push(s1[i] ^ x[i])}
buf.pack(“C*”)
end

您可能感兴趣的文章

  1. mysql不能启动 Manager of pid-file quit without updating file.
  2. rails3.0 安装mysql2 失败,发生lmysqlclient 错误
  3. mysql 横向扩展性
  4. mysql 纵向扩展性
  5. mysql 字符串转换成数字
  6. MySql用户创建、授权以及删除
  7. MySQL server has gone away
  8. MySQL 导入慢的解决方法
  9. mysql my.cnf
  10. mysql 配置文件
分享到Twitter 分享到新浪微博 分享到开心 分享到QQ空间 分享到人人 分享到鲜果 分享到豆瓣 分享到网易微博 分享到搜狐微博
You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.

Powered by WordPress | Find Wireless Deals at BestInCellPhones.com. | Thanks to iCellPhoneDeals.com Free Cell Phones, Find Highest CD Rates and Incinerador De Grasa Revisión