pub fn escape_like(text: &str) -> StringExpand description
Escapes %, _ and \ so text matches literally in a LIKE ... ESCAPE '\'
pattern (Rails’ sanitize_sql_like).
Query::contains, starts_with and
ends_with call it; use it for hand-written SQL.
§Examples
use ocre::{escape_like, params};
assert_eq!(escape_like("50%_off\\"), "50\\%\\_off\\\\");
let pattern = format!("%{}%", escape_like("50%"));
let sql = "SELECT * FROM products WHERE name LIKE ?1 ESCAPE '\\'";