6

Is there any MySQL library for Ruby that supports parameterization? 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.

1
  • You could always fall back to raw SQL prepared statements Commented Aug 24, 2011 at 22:37

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.