开发者

MySQL parameterization in Ruby

开发者 https://www.devze.com 2023-03-30 06:40 出处:网络
Is there any MySQL library for Ruby that supports pa开发者_如何学JAVArameterization? The documentation for mysql2 gives this example:

Is there any MySQL library for Ruby that supports pa开发者_如何学JAVArameterization? The documentation for mysql2 gives this example:

escaped = client.escape("gi'thu\"bbe\0r's")
results = client.query("SELECT * FROM users WHERE group='#{escaped}'")

And that seems kind of clunky and screw-up-able to me.


Sequel does, too. But for MySQL it only simulates them:

The MySQL ruby driver does not support bound variables, so the bound variable methods fall back to string interpolation.


Apparently DBI does http://ruby-dbi.rubyforge.org/

0

精彩评论

暂无评论...
验证码 换一张
取 消