pub mod client; pub mod pg_acl; pub mod pg_attribute; pub mod pg_class; pub mod pg_database; pub mod pg_namespace; pub mod pg_role; /// Given a raw identifier (such as a table name, column name, etc.), format it /// so that it may be safely interpolated into a SQL query. pub fn escape_identifier(identifier: &str) -> String { // Escaping identifiers for Postgres is fairly easy, provided that the input is // already known to contain no invalid multi-byte sequences. Backslashes may // remain as-is, and embedded double quotes are escaped simply by doubling // them (`"` becomes `""`). Refer to the PQescapeInternal() function in // libpq (fe-exec.c) and Diesel's PgQueryBuilder::push_identifier(). format!("\"{}\"", identifier.replace('"', "\"\"")) }