How do you create prepared statements with the mysql2 gem?

前端 未结 7 1666
情歌与酒
情歌与酒 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:07

    I'm also surprised that the prepare method is missing. Surely in a common ActiveRecord and Mysql2 setup, ActiveRecord must be escaping the strings rather then using libmysql, which I find a tiny bit worrying.

    In the meantime, you can use https://github.com/brianmario/mysql2/tree/stmt

提交回复
热议问题