新手问题 mysql 和 mysql2 有什么不一样

kikyous · 2012年06月22日 · 最后由 lyfi2003 回复于 2012年06月22日 · 4776 次阅读

rt

共收到 2 条回复

官方叙述如下: Someone: Dude, the Mysql gem works fiiiiiine. Me: It sure does, but it only hands you nil and strings for field values. Leaving you to convert them into proper Ruby types in Ruby-land - which is slow as balls.

Someone: OK fine, but do_mysql can already give me back values with Ruby objects mapped to MySQL types. Me: Yep, but it's API is considerably more complex and can be ~2x slower.

Performance有差别: These results are from the query_with_mysql_casting.rb script in the benchmarks folder user system total real Mysql2 0.750000 0.180000 0.930000 ( 1.821655) do_mysql 1.650000 0.200000 1.850000 ( 2.811357) Mysql 7.500000 0.210000 7.710000 ( 8.065871)

另外,编码的兼容性上貌似也有差别。

mysql 驱动貌似不再更新了, 现在rails3的驱动全用的mysql2

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册