Inline database quotation functions

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-07 16:17:14 +02:00
parent 01d502337d
commit 9d0b632e9c
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 2 additions and 0 deletions

View File

@ -148,10 +148,12 @@ pub async fn close_database_connection(conn: MySqlConnection) {
}
}
#[inline]
pub fn quote_literal(s: &str) -> String {
format!("'{}'", s.replace('\'', r"\'"))
}
#[inline]
pub fn quote_identifier(s: &str) -> String {
format!("`{}`", s.replace('`', r"\`"))
}