Module | DataObjects::Quoting |
In: |
lib/data_objects/quoting.rb
|
Escape a string of SQL with a set of arguments. The first argument is assumed to be the SQL to escape, the remaining arguments (if any) are assumed to be values to escape and interpolate.
escape_sql("SELECT * FROM zoos") # => "SELECT * FROM zoos" escape_sql("SELECT * FROM zoos WHERE name = ?", "Dallas") # => "SELECT * FROM zoos WHERE name = `Dallas`" escape_sql("SELECT * FROM zoos WHERE name = ? AND acreage > ?", "Dallas", 40) # => "SELECT * FROM zoos WHERE name = `Dallas` AND acreage > 40"
This method is meant mostly for adapters that don‘t support bind-parameters.