How do you create prepared statements with the mysql2 gem?

前端 未结 7 1739
情歌与酒
情歌与酒 2021-01-04 00:50

I\'ve tried using google to answer this seemingly simple question, but to my surprise, it didn\'t help.

I have code in my rails application currently using the \'pre

7条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-04 01:14

    Rails and the MySQL Active Record adaptor does not have any support for prepared statements as far as I know:

    http://patshaughnessy.net/2011/10/22/show-some-love-for-prepared-statements-in-rails-3-1

    This is because they actually don't have any use in speeding statements up and can actually slow things down due to MySQL's lack of query planning.

提交回复
热议问题