MySQL parameterization in Ruby

Is there any MySQL library for Ruby that supports parameterization? The documentation for mysql2 shows an example:

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

And that seems awkward and painful to me.

+6
source share
2 answers

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

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

+3
source

Obviously, DBI does http://ruby-dbi.rubyforge.org/

+3
source

Source: https://habr.com/ru/post/895809/


All Articles