pub fn quote_literal(s: &str) -> StringExpand description
Quote a SQL literal string.
This function wraps the string in single quotes and escapes any embedded single quotes by doubling them. This is only for cases where parameterized queries can’t be used (e.g., SET commands).
§Warning
Prefer using parameterized queries with SqlParam instead of this function
whenever possible. This function should only be used for SQL constructs
that don’t support parameters (like some SET commands).
§Examples
use postrust_sql::quote_literal;
assert_eq!(quote_literal("hello"), "'hello'");
assert_eq!(quote_literal("it's"), "'it''s'");