Skip to main content

Module sql_escape

Module sql_escape 

Source
Expand description

SQL string-literal escaping helpers, shared across crates.

Mirrors how production SQL emitters handle single-quote escape in string literals. Centralizing the helper means future hardening (NUL byte filtering, backslash escapes for MySQL ANSI_QUOTES, …) lands in one place instead of being re-applied across 5+ callsites in vespertide-cli, vespertide-core, and vespertide-query.

Functions§

escape_sql_string_literal
Escape SQL single quotes by doubling them — the canonical, portable way to embed a string inside a '...' literal across Postgres / MySQL / SQLite. Returns a borrowed slice when no escape is required (zero allocation), otherwise an owned String.