pub fn escape_sql_string(s: &str) -> StringExpand description
Escape a string literal for use in SQL queries.
PostgreSQL string literals are quoted with single quotes and any internal single quotes must be escaped by doubling them.
§Examples
use grant::config::sql_utils::escape_sql_string;
assert_eq!(escape_sql_string("password"), "password");
assert_eq!(escape_sql_string("pass'word"), "pass''word");
assert_eq!(escape_sql_string("it's"), "it''s");§Security
This function prevents SQL injection in string literals by escaping single quotes that could terminate the string.