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

kikyous · June 22, 2012 · Last by lyfi2003 replied at June 22, 2012 · 5624 hits

rt

官方叙述如下: 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

You need to Sign in before reply, if you don't have an account, please Sign up first.