Skip to main content

quote_ident

Function quote_ident 

Source
pub fn quote_ident(name: &str) -> String
Expand description

Quote a SQL identifier using ANSI double-quoting.

Embedded double-quotes are escaped by doubling them ("""). This function is safe against SQL injection for any input string.

§Examples

use sqlmodel_core::quote_ident;

assert_eq!(quote_ident("users"), "\"users\"");
assert_eq!(quote_ident("user\"name"), "\"user\"\"name\"");
assert_eq!(quote_ident("select"), "\"select\""); // SQL keyword